ProjectExplorer: Prepare more flexibility to aspect layouting

This hides the explicit use of a QFormLayout from the aspect
interface in a new LayoutBuilder class. That currently works
only on a QFormLayout in the back, but opens the possibility
to use e.g. a QGridLayout as use on the Kits and some option
pages.

The aspects now only announce sub-widgets they like to add,
actuall positioning is does by a new LayoutBuilder class,
also cramming several widgets in an hbox in the right column
of the QFormLayout is done there.

Change-Id: I2b788192c465f2ab82261849d34e514697c5a491
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-10-15 17:20:51 +02:00
parent 02350520c2
commit 6eaf239777
20 changed files with 251 additions and 140 deletions

View File

@@ -82,7 +82,7 @@ public:
FileInSettings
};
void addToConfigurationLayout(QFormLayout *layout) final;
void addToLayout(LayoutBuilder &builder) final;
void toMap(QVariantMap &map) const final;
void fromMap(const QVariantMap &map) final;
@@ -117,7 +117,7 @@ MainQmlFileAspect::MainQmlFileAspect(QmlProject *project)
this, [this] { changeCurrentFile(); });
}
void MainQmlFileAspect::addToConfigurationLayout(QFormLayout *layout)
void MainQmlFileAspect::addToLayout(LayoutBuilder &builder)
{
QTC_ASSERT(!m_fileListCombo, delete m_fileListCombo);
m_fileListCombo = new QComboBox;
@@ -130,7 +130,8 @@ void MainQmlFileAspect::addToConfigurationLayout(QFormLayout *layout)
connect(m_fileListCombo, QOverload<int>::of(&QComboBox::activated),
this, &MainQmlFileAspect::setMainScript);
layout->addRow(QmlProjectRunConfiguration::tr("Main QML file:"), m_fileListCombo);
builder.addItem(QmlProjectRunConfiguration::tr("Main QML file:"));
builder.addItem(m_fileListCombo.data());
}
void MainQmlFileAspect::toMap(QVariantMap &map) const