diff --git a/src/blackgui/components/enablefordockwidgetinfoarea.cpp b/src/blackgui/components/enablefordockwidgetinfoarea.cpp index 77f9a88da..4196e8a44 100644 --- a/src/blackgui/components/enablefordockwidgetinfoarea.cpp +++ b/src/blackgui/components/enablefordockwidgetinfoarea.cpp @@ -28,49 +28,49 @@ namespace BlackGui { // it the parent is already an info area at this time, we keep it // otherwise we expect the info area to set it later - this->m_parentDockableInfoArea = parentInfoArea; + m_parentDockableInfoArea = parentInfoArea; } bool CEnableForDockWidgetInfoArea::setParentDockWidgetInfoArea(CDockWidgetInfoArea *parentDockableWidget) { // sanity check - if (this->m_parentDockableInfoArea) + if (m_parentDockableInfoArea) { // we already have a value // changes should not happen - Q_ASSERT_X(this->m_parentDockableInfoArea == parentDockableWidget, Q_FUNC_INFO, "Reassigned parent dock widget area"); - return this->m_parentDockableInfoArea == parentDockableWidget; + Q_ASSERT_X(m_parentDockableInfoArea == parentDockableWidget, Q_FUNC_INFO, "Reassigned parent dock widget area"); + return m_parentDockableInfoArea == parentDockableWidget; } m_parentDockableInfoArea = parentDockableWidget; QMetaObject::Connection con = QDockWidget::connect(parentDockableWidget, &QDockWidget::destroyed, [this] { // break dependency to dockable widget - this->m_parentDockableInfoArea = nullptr; + m_parentDockableInfoArea = nullptr; }); Q_ASSERT_X(con, Q_FUNC_INFO, "Connection failed"); - this->m_connections.append(con); + m_connections.append(con); return true; } CInfoArea *CEnableForDockWidgetInfoArea::getParentInfoArea() const { - Q_ASSERT(this->m_parentDockableInfoArea); - if (!this->m_parentDockableInfoArea) return nullptr; - return this->m_parentDockableInfoArea->getParentInfoArea(); + Q_ASSERT(m_parentDockableInfoArea); + if (!m_parentDockableInfoArea) return nullptr; + return m_parentDockableInfoArea->getParentInfoArea(); } bool CEnableForDockWidgetInfoArea::isParentDockWidgetFloating() const { - Q_ASSERT(this->m_parentDockableInfoArea); - if (!this->m_parentDockableInfoArea) { return false; } - return this->m_parentDockableInfoArea->isFloating(); + Q_ASSERT(m_parentDockableInfoArea); + if (!m_parentDockableInfoArea) { return false; } + return m_parentDockableInfoArea->isFloating(); } bool CEnableForDockWidgetInfoArea::isVisibleWidget() const { - if (!this->m_parentDockableInfoArea) { return false; } // can happen function is used while dock widget not yet fully initialized - return this->m_parentDockableInfoArea->isVisibleWidget(); + if (!m_parentDockableInfoArea) { return false; } // can happen function is used while dock widget not yet fully initialized + return m_parentDockableInfoArea->isVisibleWidget(); } CEnableForFramelessWindow *CEnableForDockWidgetInfoArea::mainApplicationWindow() const diff --git a/src/blackgui/dockwidgetinfoarea.cpp b/src/blackgui/dockwidgetinfoarea.cpp index 085ee8725..419c62eed 100644 --- a/src/blackgui/dockwidgetinfoarea.cpp +++ b/src/blackgui/dockwidgetinfoarea.cpp @@ -97,8 +97,10 @@ namespace BlackGui void CDockWidgetInfoArea::initialFloating() { CDockWidget::initialFloating(); // initial floating to init position & size + + // set the top level dock widget area to all children QList infoAreaDockWidgets = this->findEmbeddedDockWidgetInfoAreaComponents(); - for(CEnableForDockWidgetInfoArea *dwia : infoAreaDockWidgets) + for (CEnableForDockWidgetInfoArea *dwia : infoAreaDockWidgets) { Q_ASSERT_X(dwia, Q_FUNC_INFO, "Missing info area"); dwia->setParentDockWidgetInfoArea(this); @@ -107,12 +109,14 @@ namespace BlackGui QList CDockWidgetInfoArea::findEmbeddedDockWidgetInfoAreaComponents() { - QList widgets = this->findChildren(); + QList widgets = this->findChildren(); // must not use Qt::FindDirectChildrenOnly here QList widgetsWithDockWidgetInfoAreaComponent; - for(QWidget *w : widgets) + for (QWidget *w : widgets) { Q_ASSERT(w); - CEnableForDockWidgetInfoArea *dwc = dynamic_cast(w); + + // CEnableForDockWidgetInfoArea is no QObject, so we use dynamic_cast + CEnableForDockWidgetInfoArea *dwc = dynamic_cast(w); if (dwc) { widgetsWithDockWidgetInfoAreaComponent.append(dwc); @@ -122,13 +126,13 @@ namespace BlackGui if (nestedInfoAreas.isEmpty()) return widgetsWithDockWidgetInfoAreaComponent; // we have to exclude the nested embedded areas - for(CDockWidgetInfoArea *ia : nestedInfoAreas) + for (CDockWidgetInfoArea *ia : nestedInfoAreas) { QList nestedInfoAreaComponents = ia->findEmbeddedDockWidgetInfoAreaComponents(); if (nestedInfoAreaComponents.isEmpty()) { continue; } - for(CEnableForDockWidgetInfoArea *iac : nestedInfoAreaComponents) + for (CEnableForDockWidgetInfoArea *iac : nestedInfoAreaComponents) { - bool r = widgetsWithDockWidgetInfoAreaComponent.removeOne(iac); + const bool r = widgetsWithDockWidgetInfoAreaComponent.removeOne(iac); Q_ASSERT(r); // why is the nested component not in the child list? Q_UNUSED(r); } @@ -138,6 +142,7 @@ namespace BlackGui QList CDockWidgetInfoArea::findNestedInfoAreas() { + // must not use Qt::FindDirectChildrenOnly here QList nestedInfoAreas = this->findChildren(); return nestedInfoAreas; } diff --git a/src/blackgui/infoarea.cpp b/src/blackgui/infoarea.cpp index 31ab7eb9f..3e4f572bb 100644 --- a/src/blackgui/infoarea.cpp +++ b/src/blackgui/infoarea.cpp @@ -582,7 +582,7 @@ namespace BlackGui // if we have > 1 docked widgets, we have a tab bar if (m_tabBar) { - QString qss = sGui->getStyleSheetUtility().style(CStyleSheetUtility::fileNameDockWidgetTab()); + const QString qss = sGui->getStyleSheetUtility().style(CStyleSheetUtility::fileNameDockWidgetTab()); m_tabBar->setStyleSheet(qss); m_tabBar->setObjectName("comp_MainInfoAreaDockWidgetTab"); m_tabBar->setMovable(false); @@ -649,9 +649,9 @@ namespace BlackGui void CInfoArea::emitInfoAreaStatus() { - int sia = this->getSelectedDockInfoAreaIndex(); - QList floating = this->getAreaIndexesDockedOrFloating(true); - QList docked = this->getAreaIndexesDockedOrFloating(false); + const int sia = this->getSelectedDockInfoAreaIndex(); + const QList floating = this->getAreaIndexesDockedOrFloating(true); + const QList docked = this->getAreaIndexesDockedOrFloating(false); emit changedInfoAreaStatus(sia, docked, floating); }