Ref T184, only search in own direct children

https://swift-project.slack.com/archives/C04J6J76N/p1510427932000021

* CInfoArea::findOwnDockWidgetInfoAreas
* CInfoArea::findOwnChildInfoAreas
This commit is contained in:
Klaus Basan
2017-11-12 02:39:24 +01:00
parent e9e2ac1e03
commit 9a2c4573dc
2 changed files with 10 additions and 27 deletions

View File

@@ -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<CDockWidgetInfoArea *> CInfoArea::findOwnDockWidgetInfoAreas() const
{
QList<CDockWidgetInfoArea *> infoAreas = this->findChildren<CDockWidgetInfoArea *>();
if (infoAreas.isEmpty()) { return infoAreas; }
// own dock widget areas without nested ones
return this->findChildren<CDockWidgetInfoArea *>(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<CDockWidgetInfoArea *> 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 *> CInfoArea::findOwnChildInfoAreas() const
{
return this->findChildren<CInfoArea *>(QString(), Qt::FindDirectChildrenOnly);
}
void CInfoArea::emitInfoAreaStatus()

View File

@@ -270,7 +270,7 @@ namespace BlackGui
//! 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 *> findOwnChildInfoAreas() const;
//! Direct dock widget areas, not the nested dock widget areas
//! \remark result stored in m_dockableWidgets