forked from qt-creator/qt-creator
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:
@@ -157,7 +157,7 @@ public:
|
||||
|
||||
void fromMap(const QVariantMap &) override;
|
||||
void toMap(QVariantMap &) const override;
|
||||
void addToConfigurationLayout(QFormLayout *layout) override;
|
||||
void addToLayout(LayoutBuilder &builder) override;
|
||||
|
||||
private:
|
||||
void updateCurrentInterpreter();
|
||||
@@ -190,26 +190,23 @@ void InterpreterAspect::toMap(QVariantMap &map) const
|
||||
map.insert(settingsKey(), m_currentId);
|
||||
}
|
||||
|
||||
void InterpreterAspect::addToConfigurationLayout(QFormLayout *layout)
|
||||
void InterpreterAspect::addToLayout(LayoutBuilder &builder)
|
||||
{
|
||||
if (QTC_GUARD(m_comboBox.isNull()))
|
||||
m_comboBox = new QComboBox;
|
||||
|
||||
updateComboBox();
|
||||
connect(m_comboBox,
|
||||
&QComboBox::currentTextChanged,
|
||||
this,
|
||||
&InterpreterAspect::updateCurrentInterpreter);
|
||||
connect(m_comboBox, &QComboBox::currentTextChanged,
|
||||
this, &InterpreterAspect::updateCurrentInterpreter);
|
||||
|
||||
auto manageButton = new QPushButton(tr("Manage..."));
|
||||
connect(manageButton, &QPushButton::clicked, []() {
|
||||
Core::ICore::showOptionsDialog(Constants::C_PYTHONOPTIONS_PAGE_ID);
|
||||
});
|
||||
|
||||
auto rowLayout = new QHBoxLayout;
|
||||
rowLayout->addWidget(m_comboBox);
|
||||
rowLayout->addWidget(manageButton);
|
||||
layout->addRow(tr("Interpreter"), rowLayout);
|
||||
builder.addItem(tr("Interpreter"));
|
||||
builder.addItem(m_comboBox.data());
|
||||
builder.addItem(manageButton);
|
||||
}
|
||||
|
||||
void InterpreterAspect::updateCurrentInterpreter()
|
||||
|
||||
Reference in New Issue
Block a user