Ref T184, keep list of child widgets, do not always search

This commit is contained in:
Klaus Basan
2017-11-08 04:01:05 +01:00
parent 095e11d288
commit 72d3756605
2 changed files with 15 additions and 8 deletions

View File

@@ -51,7 +51,12 @@ namespace BlackGui
void CInfoArea::initInfoArea() void CInfoArea::initInfoArea()
{ {
// after(!) GUI is setup // 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()) if (m_dockWidgetInfoAreas.isEmpty())
{ {
m_dockWidgetInfoAreas = this->findOwnDockWidgetInfoAreas(); m_dockWidgetInfoAreas = this->findOwnDockWidgetInfoAreas();
@@ -476,7 +481,7 @@ namespace BlackGui
{ {
dw->displayStatusMessage(statusMessage); dw->displayStatusMessage(statusMessage);
} }
for (CInfoArea *ia : this->getChildInfoAreas()) for (CInfoArea *ia : m_childInfoAreas)
{ {
ia->displayStatusMessage(statusMessage); ia->displayStatusMessage(statusMessage);
} }
@@ -488,7 +493,7 @@ namespace BlackGui
{ {
dw->displayStatusMessages(statusMessages); dw->displayStatusMessages(statusMessages);
} }
for (CInfoArea *ia : this->getChildInfoAreas()) for (CInfoArea *ia : m_childInfoAreas)
{ {
ia->displayStatusMessages(statusMessages); ia->displayStatusMessages(statusMessages);
} }
@@ -642,11 +647,10 @@ namespace BlackGui
if (infoAreas.isEmpty()) { return infoAreas; } if (infoAreas.isEmpty()) { return infoAreas; }
// nested info areas? // nested info areas?
QList<CInfoArea *> childInfoAreas = this->getChildInfoAreas(); if (m_childInfoAreas.isEmpty()) { return infoAreas; }
if (childInfoAreas.isEmpty()) { return infoAreas; }
// we have child info areas (nested), we need to remove those from the list // we have child info areas (nested), we need to remove those from the list
for (CInfoArea *ia : childInfoAreas) for (CInfoArea *ia : m_childInfoAreas)
{ {
QList<CDockWidgetInfoArea *> nestedDockWidgets = ia->m_dockWidgetInfoAreas; QList<CDockWidgetInfoArea *> nestedDockWidgets = ia->m_dockWidgetInfoAreas;
if (nestedDockWidgets.isEmpty()) { continue; } if (nestedDockWidgets.isEmpty()) { continue; }

View File

@@ -191,6 +191,7 @@ namespace BlackGui
private: private:
QList<CDockWidgetInfoArea *> m_dockWidgetInfoAreas; QList<CDockWidgetInfoArea *> m_dockWidgetInfoAreas;
QList<CInfoArea *> m_childInfoAreas;
QTabBar *m_tabBar = nullptr; QTabBar *m_tabBar = nullptr;
bool m_showTabTexts = true; //!< texts for tabs bool m_showTabTexts = true; //!< texts for tabs
bool m_infoAreaFloating = false; //!< whole info area floating? bool m_infoAreaFloating = false; //!< whole info area floating?
@@ -234,10 +235,12 @@ namespace BlackGui
void connectTopLevelChanged(); void connectTopLevelChanged();
//! Nested info areas //! Nested info areas
//! \remark weak performance as discussed in T184
//! \remark result stored in m_childInfoAreas
QList<CInfoArea *> getChildInfoAreas() const { return this->findChildren<CInfoArea *>(); } QList<CInfoArea *> getChildInfoAreas() const { return this->findChildren<CInfoArea *>(); }
//! Direct dock widget areas, not the nested dock widget areas //! Direct dock widget areas, not the nested dock widget areas
//! \remarks result stored in m_dockableWidgets //! \remark result stored in m_dockableWidgets
QList<CDockWidgetInfoArea *> findOwnDockWidgetInfoAreas() const; QList<CDockWidgetInfoArea *> findOwnDockWidgetInfoAreas() const;
private slots: private slots: