mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-30 22:29:13 +08:00
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:
@@ -54,14 +54,9 @@ namespace BlackGui
|
|||||||
// initInfoArea() needs be called after(!) GUI is setup
|
// initInfoArea() needs be called after(!) GUI is setup
|
||||||
|
|
||||||
// Ref T184, child areas are now "cached" in m_childInfoAreas
|
// 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
|
// The original version did always use "findChildInfoAreas", so if there are ever any issues T184 might be reverted
|
||||||
// 2) m_childInfoAreas needs to be initialized before findOwnDockWidgetInfoAreas
|
m_childInfoAreas = this->findOwnChildInfoAreas();
|
||||||
m_childInfoAreas = this->getChildInfoAreas();
|
m_dockWidgetInfoAreas = this->findOwnDockWidgetInfoAreas();
|
||||||
if (m_dockWidgetInfoAreas.isEmpty())
|
|
||||||
{
|
|
||||||
m_dockWidgetInfoAreas = this->findOwnDockWidgetInfoAreas();
|
|
||||||
Q_ASSERT(!m_dockWidgetInfoAreas.isEmpty());
|
|
||||||
}
|
|
||||||
|
|
||||||
this->setDockArea(Qt::TopDockWidgetArea);
|
this->setDockArea(Qt::TopDockWidgetArea);
|
||||||
this->connectTopLevelChanged();
|
this->connectTopLevelChanged();
|
||||||
@@ -643,25 +638,13 @@ namespace BlackGui
|
|||||||
|
|
||||||
QList<CDockWidgetInfoArea *> CInfoArea::findOwnDockWidgetInfoAreas() const
|
QList<CDockWidgetInfoArea *> CInfoArea::findOwnDockWidgetInfoAreas() const
|
||||||
{
|
{
|
||||||
QList<CDockWidgetInfoArea *> infoAreas = this->findChildren<CDockWidgetInfoArea *>();
|
// own dock widget areas without nested ones
|
||||||
if (infoAreas.isEmpty()) { return infoAreas; }
|
return this->findChildren<CDockWidgetInfoArea *>(QString(), Qt::FindDirectChildrenOnly);
|
||||||
|
}
|
||||||
|
|
||||||
// nested info areas?
|
QList<CInfoArea *> CInfoArea::findOwnChildInfoAreas() const
|
||||||
if (m_childInfoAreas.isEmpty()) { return infoAreas; }
|
{
|
||||||
|
return this->findChildren<CInfoArea *>(QString(), Qt::FindDirectChildrenOnly);
|
||||||
// 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInfoArea::emitInfoAreaStatus()
|
void CInfoArea::emitInfoAreaStatus()
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ namespace BlackGui
|
|||||||
//! Nested info areas
|
//! Nested info areas
|
||||||
//! \remark weak performance as discussed in T184
|
//! \remark weak performance as discussed in T184
|
||||||
//! \remark result stored in m_childInfoAreas
|
//! \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
|
//! Direct dock widget areas, not the nested dock widget areas
|
||||||
//! \remark result stored in m_dockableWidgets
|
//! \remark result stored in m_dockableWidgets
|
||||||
|
|||||||
Reference in New Issue
Block a user