forked from qt-creator/qt-creator
Utils: Use a full layout row for an aspect for Columns and Forms
Avoids some boilerplate on the user code side. This seems to be the only existing case. If there'd ever be a case where this is not appropriate, an extra Row { ... } would solve it. Change-Id: I1ae1102e895640c0acc03b4949e3baabecfcdc49 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -331,10 +331,13 @@ LayoutBuilder &LayoutBuilder::addRow(const LayoutItems &items)
|
||||
*/
|
||||
LayoutBuilder &LayoutBuilder::addItem(const LayoutItem &item)
|
||||
{
|
||||
if (item.aspect)
|
||||
if (item.aspect) {
|
||||
item.aspect->addToLayout(*this);
|
||||
else
|
||||
if (m_layoutType == FormLayout || m_layoutType == VBoxLayout)
|
||||
finishRow();
|
||||
} else {
|
||||
m_items.push_back(item);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@@ -125,9 +125,7 @@ OptionsPageWidget::OptionsPageWidget(const std::function<void(void)> &onApply, B
|
||||
: m_onApply(onApply), m_settings(settings)
|
||||
{
|
||||
BazaarSettings &s = *m_settings;
|
||||
|
||||
using namespace Layouting;
|
||||
const Break nl;
|
||||
|
||||
Column {
|
||||
Group {
|
||||
@@ -138,7 +136,7 @@ OptionsPageWidget::OptionsPageWidget(const std::function<void(void)> &onApply, B
|
||||
Group {
|
||||
Title(tr("User")),
|
||||
Form {
|
||||
s.userName, nl,
|
||||
s.userName,
|
||||
s.userEmail
|
||||
}
|
||||
},
|
||||
|
@@ -306,9 +306,9 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
|
||||
|
||||
Column {
|
||||
Form {
|
||||
buildDirAspect, Break(),
|
||||
bc->aspect<InitialCMakeArgumentsAspect>(), Break(),
|
||||
bc->aspect<BuildTypeAspect>(), Break(),
|
||||
buildDirAspect,
|
||||
bc->aspect<InitialCMakeArgumentsAspect>(),
|
||||
bc->aspect<BuildTypeAspect>(),
|
||||
qmlDebugAspect
|
||||
},
|
||||
Space(10),
|
||||
|
@@ -112,20 +112,19 @@ CvsSettingsPageWidget::CvsSettingsPageWidget(const std::function<void()> &onAppl
|
||||
{
|
||||
CvsSettings &s = *settings;
|
||||
using namespace Layouting;
|
||||
const Break nl;
|
||||
|
||||
Column {
|
||||
Group {
|
||||
Title(tr("Configuration")),
|
||||
Form {
|
||||
s.binaryPath, nl,
|
||||
s.binaryPath,
|
||||
s.cvsRoot
|
||||
}
|
||||
},
|
||||
Group {
|
||||
Title(tr("Miscellaneous")),
|
||||
Form {
|
||||
s.timeout, nl,
|
||||
s.timeout,
|
||||
s.diffOptions,
|
||||
},
|
||||
s.promptOnSubmit,
|
||||
|
@@ -137,7 +137,7 @@ DockerConfigWidget::DockerConfigWidget(DockerSettings *settings)
|
||||
Group {
|
||||
Title(tr("Search images on Docker Hub")),
|
||||
Form {
|
||||
s.imageListFilter, Break(),
|
||||
s.imageListFilter,
|
||||
s.imageList
|
||||
},
|
||||
},
|
||||
|
@@ -85,9 +85,7 @@ OptionsPageWidget::OptionsPageWidget(const std::function<void()> &onApply, Mercu
|
||||
: m_onApply(onApply), m_settings(settings)
|
||||
{
|
||||
MercurialSettings &s = *settings;
|
||||
|
||||
using namespace Layouting;
|
||||
const Break nl;
|
||||
|
||||
Column {
|
||||
Group {
|
||||
@@ -98,7 +96,7 @@ OptionsPageWidget::OptionsPageWidget(const std::function<void()> &onApply, Mercu
|
||||
Group {
|
||||
Title(tr("User")),
|
||||
Form {
|
||||
s.userName, nl,
|
||||
s.userName,
|
||||
s.userEmail
|
||||
}
|
||||
},
|
||||
|
@@ -110,7 +110,7 @@ QWidget *NimbleTaskStep::createConfigWidget()
|
||||
|
||||
using namespace Layouting;
|
||||
auto widget = Form {
|
||||
m_taskArgs, Break(),
|
||||
m_taskArgs,
|
||||
tr("Tasks:"), taskList
|
||||
}.emerge(false);
|
||||
|
||||
|
@@ -129,9 +129,7 @@ SubversionSettingsPageWidget::SubversionSettingsPageWidget(const std::function<v
|
||||
: m_onApply(onApply), m_settings(settings)
|
||||
{
|
||||
SubversionSettings &s = *m_settings;
|
||||
|
||||
using namespace Layouting;
|
||||
Break nl;
|
||||
|
||||
Column {
|
||||
Group {
|
||||
@@ -142,15 +140,15 @@ SubversionSettingsPageWidget::SubversionSettingsPageWidget(const std::function<v
|
||||
Group {
|
||||
Title(tr("Authentication"), &s.useAuthentication),
|
||||
Form {
|
||||
s.userName, nl,
|
||||
s.userName,
|
||||
s.password,
|
||||
}
|
||||
},
|
||||
|
||||
Group {
|
||||
Title(tr("Miscellaneous")),
|
||||
Row { s.logCount, s.timeout, Stretch() }, nl,
|
||||
s.promptOnSubmit, nl,
|
||||
Row { s.logCount, s.timeout, Stretch() },
|
||||
s.promptOnSubmit,
|
||||
s.spaceIgnorantAnnotation,
|
||||
},
|
||||
|
||||
|
Reference in New Issue
Block a user