ProjectExplorer: Make LayoutBuilder aware of aspects

Change-Id: I3091808309904eeadf5001a68438a9b501dd9fc7
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2020-07-29 09:02:05 +02:00
parent 3552c95980
commit 2b10727625
2 changed files with 10 additions and 3 deletions

View File

@@ -135,9 +135,13 @@ QLayout *LayoutBuilder::layout() const
LayoutBuilder &LayoutBuilder::addItem(LayoutItem item) LayoutBuilder &LayoutBuilder::addItem(LayoutItem item)
{ {
if (item.aspect) {
item.aspect->addToLayout(*this);
} else {
if (item.widget && !item.widget->parent()) if (item.widget && !item.widget->parent())
item.widget->setParent(m_layout->parentWidget()); item.widget->setParent(m_layout->parentWidget());
m_pendingItems.append(item); m_pendingItems.append(item);
}
return *this; return *this;
} }

View File

@@ -39,6 +39,7 @@
namespace ProjectExplorer { namespace ProjectExplorer {
class Project; class Project;
class ProjectConfigurationAspect;
class ProjectConfigurationAspects; class ProjectConfigurationAspects;
class Target; class Target;
@@ -53,10 +54,12 @@ public:
public: public:
LayoutItem(QLayout *layout) : layout(layout) {} LayoutItem(QLayout *layout) : layout(layout) {}
LayoutItem(QWidget *widget) : widget(widget) {} LayoutItem(QWidget *widget) : widget(widget) {}
LayoutItem(ProjectConfigurationAspect *aspect) : aspect(aspect) {}
LayoutItem(const QString &text) : text(text) {} LayoutItem(const QString &text) : text(text) {}
QLayout *layout = nullptr; QLayout *layout = nullptr;
QWidget *widget = nullptr; QWidget *widget = nullptr;
ProjectConfigurationAspect *aspect = nullptr;
QString text; QString text;
}; };