Utils: Introduce a Layouting::empty item

A bit more explicit than the current mix of Space() and asserting {}.

Change-Id: Ia296b1d23294dfccd1e33827e136b821a4d2c6fe
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
hjk
2022-07-25 17:56:47 +02:00
parent e9a13d83a4
commit dc839df59b
7 changed files with 7 additions and 7 deletions

View File

@@ -1491,7 +1491,7 @@ void SelectionAspect::addToLayout(LayoutBuilder &builder)
button->setChecked(i == value()); button->setChecked(i == value());
button->setEnabled(option.enabled); button->setEnabled(option.enabled);
button->setToolTip(option.tooltip); button->setToolTip(option.tooltip);
builder.addItems({{}, button}); builder.addItems({Layouting::empty, button});
d->m_buttons.append(button); d->m_buttons.append(button);
d->m_buttonGroup->addButton(button, i); d->m_buttonGroup->addButton(button, i);
if (isAutoApply()) { if (isAutoApply()) {

View File

@@ -75,7 +75,7 @@ FileWizardPage::FileWizardPage(QWidget *parent) :
using namespace Layouting; using namespace Layouting;
Form { Form {
Space(), d->m_defaultSuffixLabel, br, empty, d->m_defaultSuffixLabel, br,
tr("File name:"), d->m_nameLineEdit, br, tr("File name:"), d->m_nameLineEdit, br,
tr("Path:"), d->m_pathChooser tr("Path:"), d->m_pathChooser
}.attachTo(this); }.attachTo(this);

View File

@@ -511,6 +511,7 @@ LayoutBuilder::Setter title(const QString &title, BoolAspect *checker)
LayoutBuilder::Break br; LayoutBuilder::Break br;
LayoutBuilder::Stretch st; LayoutBuilder::Stretch st;
LayoutBuilder::Space empty(0);
} // Layouting } // Layouting
} // Utils } // Utils

View File

@@ -117,7 +117,7 @@ public:
class QTCREATOR_UTILS_EXPORT Space : public LayoutItem class QTCREATOR_UTILS_EXPORT Space : public LayoutItem
{ {
public: public:
explicit Space(int space = 0); explicit Space(int space);
}; };
class QTCREATOR_UTILS_EXPORT Span : public LayoutItem class QTCREATOR_UTILS_EXPORT Span : public LayoutItem
@@ -226,6 +226,7 @@ using Break = LayoutBuilder::Break; // FIXME: Remove
QTCREATOR_UTILS_EXPORT extern LayoutBuilder::Break br; QTCREATOR_UTILS_EXPORT extern LayoutBuilder::Break br;
QTCREATOR_UTILS_EXPORT extern LayoutBuilder::Stretch st; QTCREATOR_UTILS_EXPORT extern LayoutBuilder::Stretch st;
QTCREATOR_UTILS_EXPORT extern LayoutBuilder::Space empty;
} // Layouting } // Layouting
} // Utils } // Utils

View File

@@ -353,7 +353,6 @@ AndroidSettingsWidget::AndroidSettingsWidget()
downloadNdkToolButton->setIcon(downloadIcon); downloadNdkToolButton->setIcon(downloadIcon);
using namespace Layouting; using namespace Layouting;
const Space empty;
Column { Column {
Group { Group {

View File

@@ -109,7 +109,6 @@ ClangFormatOptionsPageWidget::ClangFormatOptionsPageWidget(ClangFormatSettings *
useCustomizedStyle->setChecked(true); useCustomizedStyle->setChecked(true);
using namespace Utils::Layouting; using namespace Utils::Layouting;
const Space empty;
Form { Form {
m_usePredefinedStyle, m_predefinedStyle, br, m_usePredefinedStyle, m_predefinedStyle, br,

View File

@@ -124,7 +124,7 @@ GeneralSettingsWidget::GeneralSettingsWidget(GeneralSettings *q)
if (!Utils::HostOsInfo::isMacHost()) { if (!Utils::HostOsInfo::isMacHost()) {
auto dpiCheckbox = new QCheckBox(tr("Enable high DPI scaling")); auto dpiCheckbox = new QCheckBox(tr("Enable high DPI scaling"));
form.addRow({Space(), dpiCheckbox}); form.addRow({empty, dpiCheckbox});
const bool defaultValue = Utils::HostOsInfo::isWindowsHost(); const bool defaultValue = Utils::HostOsInfo::isWindowsHost();
dpiCheckbox->setChecked(ICore::settings()->value(settingsKeyDPI, defaultValue).toBool()); dpiCheckbox->setChecked(ICore::settings()->value(settingsKeyDPI, defaultValue).toBool());
connect(dpiCheckbox, &QCheckBox::toggled, this, [defaultValue](bool checked) { connect(dpiCheckbox, &QCheckBox::toggled, this, [defaultValue](bool checked) {
@@ -135,7 +135,7 @@ GeneralSettingsWidget::GeneralSettingsWidget(GeneralSettings *q)
}); });
} }
form.addRow({Space(), m_showShortcutsInContextMenus}); form.addRow({empty, m_showShortcutsInContextMenus});
form.addRow(Row{m_resetWarningsButton, st}); form.addRow(Row{m_resetWarningsButton, st});
form.addRow({tr("Text codec for tools:"), m_codecBox, st}); form.addRow({tr("Text codec for tools:"), m_codecBox, st});
Column{Group{Title(tr("User Interface")), form}}.attachTo(this); Column{Group{Title(tr("User Interface")), form}}.attachTo(this);