diff options
author | hjk <hjk@qt.io> | 2019-10-15 17:20:51 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2019-10-18 12:24:39 +0000 |
commit | 6eaf239777a3166f2504b0dff90bb4afcacba89f (patch) | |
tree | 32a2ffa2028e3ba487d62b380e40aab866c1e39f /src/plugins/projectexplorer/customexecutablerunconfiguration.cpp | |
parent | 02350520c211bf5aa4f2804c1d19d28d710daa20 (diff) |
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>
Diffstat (limited to 'src/plugins/projectexplorer/customexecutablerunconfiguration.cpp')
-rw-r--r-- | src/plugins/projectexplorer/customexecutablerunconfiguration.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp index 2f5e4463b7..e3dfd2f1a0 100644 --- a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp +++ b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp @@ -99,10 +99,6 @@ CustomExecutableDialog::CustomExecutableDialog(RunConfiguration *rc) auto vbox = new QVBoxLayout(this); vbox->addWidget(new QLabel(tr("Could not find the executable, please specify one."))); - auto layout = new QFormLayout; - layout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); - layout->setContentsMargins(0, 0, 0, 0); - auto detailsContainer = new DetailsWidget(this); detailsContainer->setState(DetailsWidget::NoSummary); vbox->addWidget(detailsContainer); @@ -116,24 +112,27 @@ CustomExecutableDialog::CustomExecutableDialog(RunConfiguration *rc) auto detailsWidget = new QWidget(detailsContainer); detailsContainer->setWidget(detailsWidget); - detailsWidget->setLayout(layout); m_executableChooser = new PathChooser(this); m_executableChooser->setHistoryCompleter("Qt.CustomExecutable.History"); m_executableChooser->setExpectedKind(PathChooser::ExistingCommand); m_executableChooser->setPath(rc->aspect<ExecutableAspect>()->executable().toString()); - layout->addRow(tr("Executable:"), m_executableChooser); connect(m_executableChooser, &PathChooser::rawPathChanged, this, &CustomExecutableDialog::changed); copyAspect(rc->aspect<ArgumentsAspect>(), &m_arguments); - m_arguments.addToConfigurationLayout(layout); - copyAspect(rc->aspect<WorkingDirectoryAspect>(), &m_workingDirectory); - m_workingDirectory.addToConfigurationLayout(layout); - copyAspect(rc->aspect<TerminalAspect>(), &m_terminal); - m_terminal.addToConfigurationLayout(layout); + + { + LayoutBuilder builder(detailsWidget); + builder.addItem(tr("Executable:")); + builder.addItem(m_executableChooser); + builder.startNewRow(); + m_arguments.addToLayout(builder); + m_workingDirectory.addToLayout(builder); + m_terminal.addToLayout(builder); + } auto enviromentAspect = rc->aspect<EnvironmentAspect>(); connect(enviromentAspect, &EnvironmentAspect::environmentChanged, |