forked from qt-creator/qt-creator
Utils: Fix FancyMainWindow
The FancyMainWindow::dockWidgets() function did find all children, even if there was another FancyMainWindow in the hierarchy with its own dock widget children. Change-Id: I44c2fe669d08a938e86e889caa570d2b19a0cac7 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -478,9 +478,25 @@ void FancyMainWindow::restoreSettings(const QHash<QString, QVariant> &settings)
|
||||
}
|
||||
}
|
||||
|
||||
static void findDockChildren(QWidget *parent, QList<QDockWidget *> &result)
|
||||
{
|
||||
for (QObject *child : parent->children()) {
|
||||
QWidget *childWidget = qobject_cast<QWidget *>(child);
|
||||
if (!childWidget)
|
||||
continue;
|
||||
|
||||
if (auto dockWidget = qobject_cast<QDockWidget *>(child))
|
||||
result.append(dockWidget);
|
||||
else if (!qobject_cast<QMainWindow *>(child))
|
||||
findDockChildren(qobject_cast<QWidget *>(child), result);
|
||||
}
|
||||
}
|
||||
|
||||
const QList<QDockWidget *> FancyMainWindow::dockWidgets() const
|
||||
{
|
||||
return findChildren<QDockWidget *>();
|
||||
QList<QDockWidget *> result;
|
||||
findDockChildren((QWidget *) this, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool FancyMainWindow::autoHideTitleBars() const
|
||||
|
||||
Reference in New Issue
Block a user