From 9a2c4573dc8a798f2484c6b1a91fbf18f38aca2b Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sun, 12 Nov 2017 02:39:24 +0100 Subject: [PATCH] Ref T184, only search in own direct children https://swift-project.slack.com/archives/C04J6J76N/p1510427932000021 * CInfoArea::findOwnDockWidgetInfoAreas * CInfoArea::findOwnChildInfoAreas --- src/blackgui/infoarea.cpp | 35 +++++++++-------------------------- src/blackgui/infoarea.h | 2 +- 2 files changed, 10 insertions(+), 27 deletions(-) diff --git a/src/blackgui/infoarea.cpp b/src/blackgui/infoarea.cpp index dcb3425c1..31ab7eb9f 100644 --- a/src/blackgui/infoarea.cpp +++ b/src/blackgui/infoarea.cpp @@ -54,14 +54,9 @@ namespace BlackGui // initInfoArea() needs be called after(!) GUI is setup // Ref T184, child areas are now "cached" in m_childInfoAreas - // 1) the original version did always use "getChildInfoAreas", so if there are ever any issues T184 might be reverted - // 2) m_childInfoAreas needs to be initialized before findOwnDockWidgetInfoAreas - m_childInfoAreas = this->getChildInfoAreas(); - if (m_dockWidgetInfoAreas.isEmpty()) - { - m_dockWidgetInfoAreas = this->findOwnDockWidgetInfoAreas(); - Q_ASSERT(!m_dockWidgetInfoAreas.isEmpty()); - } + // The original version did always use "findChildInfoAreas", so if there are ever any issues T184 might be reverted + m_childInfoAreas = this->findOwnChildInfoAreas(); + m_dockWidgetInfoAreas = this->findOwnDockWidgetInfoAreas(); this->setDockArea(Qt::TopDockWidgetArea); this->connectTopLevelChanged(); @@ -643,25 +638,13 @@ namespace BlackGui QList CInfoArea::findOwnDockWidgetInfoAreas() const { - QList infoAreas = this->findChildren(); - if (infoAreas.isEmpty()) { return infoAreas; } + // own dock widget areas without nested ones + return this->findChildren(QString(), Qt::FindDirectChildrenOnly); + } - // nested info areas? - if (m_childInfoAreas.isEmpty()) { return infoAreas; } - - // we have child info areas (nested), we need to remove those from the list - for (CInfoArea *ia : m_childInfoAreas) - { - QList nestedDockWidgets = ia->m_dockWidgetInfoAreas; - if (nestedDockWidgets.isEmpty()) { continue; } - for (CDockWidgetInfoArea *ndw : nestedDockWidgets) - { - bool r = infoAreas.removeOne(ndw); // remove nested - Q_ASSERT(r); - Q_UNUSED(r); - } - } - return infoAreas; + QList CInfoArea::findOwnChildInfoAreas() const + { + return this->findChildren(QString(), Qt::FindDirectChildrenOnly); } void CInfoArea::emitInfoAreaStatus() diff --git a/src/blackgui/infoarea.h b/src/blackgui/infoarea.h index cea2009f9..b7e96f06d 100644 --- a/src/blackgui/infoarea.h +++ b/src/blackgui/infoarea.h @@ -270,7 +270,7 @@ namespace BlackGui //! Nested info areas //! \remark weak performance as discussed in T184 //! \remark result stored in m_childInfoAreas - QList getChildInfoAreas() const { return this->findChildren(); } + QList findOwnChildInfoAreas() const; //! Direct dock widget areas, not the nested dock widget areas //! \remark result stored in m_dockableWidgets