forked from qt-creator/qt-creator
Layouting: Handle attach types via setter
Change-Id: I862f5cd109db3582b4f029787ec0cded2da39ce6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -68,8 +68,9 @@ public:
|
||||
Tr::tr("Description:"), description, br,
|
||||
Tr::tr("Copyright:"), copyright, br,
|
||||
Tr::tr("License:"), license, br,
|
||||
Tr::tr("Dependencies:"), dependencies
|
||||
}.attachTo(q, WithoutMargins);
|
||||
Tr::tr("Dependencies:"), dependencies,
|
||||
noMargin
|
||||
}.attachTo(q);
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
|
||||
@@ -45,8 +45,9 @@ public:
|
||||
|
||||
Form {
|
||||
Tr::tr("State:"), state, br,
|
||||
Tr::tr("Error message:"), errorString
|
||||
}.attachTo(q, WithoutMargins);
|
||||
Tr::tr("Error message:"), errorString,
|
||||
noMargin,
|
||||
}.attachTo(q);
|
||||
}
|
||||
|
||||
PluginErrorView *q = nullptr;
|
||||
|
||||
@@ -79,17 +79,19 @@ struct LayoutBuilder::Slice
|
||||
Slice() = default;
|
||||
Slice(QLayout *l) : layout(l) {}
|
||||
Slice(QWidget *w) : widget(w) {}
|
||||
Slice(QWidget *w, AttachType a) : widget(w), attachType(a) {}
|
||||
|
||||
QLayout *layout = nullptr;
|
||||
QWidget *widget = nullptr;
|
||||
|
||||
void flush();
|
||||
|
||||
// Grid-specific
|
||||
int currentGridColumn = 0;
|
||||
int currentGridRow = 0;
|
||||
bool isFormAlignment = false;
|
||||
Qt::Alignment align = {}; // Can be changed to
|
||||
|
||||
AttachType attachType = WithMargins;
|
||||
// Grid or Form
|
||||
QList<ResultItem> pendingItems;
|
||||
};
|
||||
|
||||
@@ -192,9 +194,6 @@ void LayoutBuilder::Slice::flush()
|
||||
} else if (auto gridLayout = qobject_cast<QGridLayout *>(layout)) {
|
||||
|
||||
for (const ResultItem &item : std::as_const(pendingItems)) {
|
||||
Qt::Alignment align = {};
|
||||
// if (attachType == Layouting::WithFormAlignment && currentGridColumn == 0)
|
||||
// align = Qt::Alignment(m_widget->style()->styleHint(QStyle::SH_FormLayoutLabelAlignment));
|
||||
if (item.widget)
|
||||
gridLayout->addWidget(item.widget, currentGridRow, currentGridColumn, 1, item.span, align);
|
||||
else if (item.layout)
|
||||
@@ -374,18 +373,18 @@ void LayoutItem::addItems(const LayoutItems &items)
|
||||
This operation can only be performed once per LayoutBuilder instance.
|
||||
*/
|
||||
|
||||
void LayoutItem::attachTo(QWidget *w, AttachType attachType) const
|
||||
void LayoutItem::attachTo(QWidget *w) const
|
||||
{
|
||||
LayoutBuilder builder;
|
||||
|
||||
builder.stack.append({w, attachType});
|
||||
builder.stack.append(w);
|
||||
addItemHelper(builder, *this);
|
||||
}
|
||||
|
||||
QWidget *LayoutItem::emerge(Layouting::AttachType attachType)
|
||||
QWidget *LayoutItem::emerge()
|
||||
{
|
||||
auto w = new QWidget;
|
||||
attachTo(w, attachType);
|
||||
attachTo(w);
|
||||
return w;
|
||||
}
|
||||
|
||||
@@ -398,8 +397,6 @@ static void layoutExit(LayoutBuilder &builder)
|
||||
{
|
||||
builder.stack.last().flush();
|
||||
QLayout *layout = builder.stack.last().layout;
|
||||
if (builder.stack.back().attachType == WithoutMargins)
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
builder.stack.pop_back();
|
||||
|
||||
if (QWidget *widget = builder.stack.last().widget)
|
||||
@@ -411,8 +408,6 @@ static void layoutExit(LayoutBuilder &builder)
|
||||
static void widgetExit(LayoutBuilder &builder)
|
||||
{
|
||||
QWidget *widget = builder.stack.last().widget;
|
||||
if (builder.stack.back().attachType == WithoutMargins)
|
||||
widget->setContentsMargins(0, 0, 0, 0);
|
||||
builder.stack.pop_back();
|
||||
builder.stack.last().pendingItems.append(ResultItem(widget));
|
||||
}
|
||||
@@ -473,6 +468,58 @@ LayoutItem empty()
|
||||
return {};
|
||||
}
|
||||
|
||||
LayoutItem hr()
|
||||
{
|
||||
LayoutItem item;
|
||||
item.onAdd = [](LayoutBuilder &builder) { doAddWidget(builder, createHr()); };
|
||||
return item;
|
||||
}
|
||||
|
||||
LayoutItem st()
|
||||
{
|
||||
LayoutItem item;
|
||||
item.onAdd = [](LayoutBuilder &builder) { doAddStretch(builder, Stretch(1)); };
|
||||
return item;
|
||||
}
|
||||
|
||||
LayoutItem noMargin()
|
||||
{
|
||||
LayoutItem item;
|
||||
item.onAdd = [](LayoutBuilder &builder) {
|
||||
if (auto layout = builder.stack.last().layout)
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
else if (auto widget = builder.stack.last().widget)
|
||||
widget->setContentsMargins(0, 0, 0, 0);
|
||||
};
|
||||
return item;
|
||||
}
|
||||
|
||||
LayoutItem normalMargin()
|
||||
{
|
||||
LayoutItem item;
|
||||
item.onAdd = [](LayoutBuilder &builder) {
|
||||
if (auto layout = builder.stack.last().layout)
|
||||
layout->setContentsMargins(9, 9, 9, 9);
|
||||
else if (auto widget = builder.stack.last().widget)
|
||||
widget->setContentsMargins(9, 9, 9, 9);
|
||||
};
|
||||
return item;
|
||||
}
|
||||
|
||||
LayoutItem withFormAlignment()
|
||||
{
|
||||
LayoutItem item;
|
||||
item.onAdd = [](LayoutBuilder &builder) {
|
||||
if (builder.stack.size() >= 2) {
|
||||
if (auto widget = builder.stack.at(builder.stack.size() - 2).widget) {
|
||||
const Qt::Alignment align(widget->style()->styleHint(QStyle::SH_FormLayoutLabelAlignment));
|
||||
builder.stack.last().align = align;
|
||||
}
|
||||
}
|
||||
};
|
||||
return item;
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructs a layout extender to extend an existing \a layout.
|
||||
|
||||
@@ -481,13 +528,12 @@ LayoutItem empty()
|
||||
new items will be added below existing ones.
|
||||
*/
|
||||
|
||||
LayoutExtender::LayoutExtender(QLayout *layout, Layouting::AttachType attachType)
|
||||
LayoutExtender::LayoutExtender(QLayout *layout)
|
||||
{
|
||||
Slice slice;
|
||||
slice.layout = layout;
|
||||
if (auto gridLayout = qobject_cast<QGridLayout *>(layout))
|
||||
slice.currentGridRow = gridLayout->rowCount();
|
||||
slice.attachType = attachType;
|
||||
stack.append(slice);
|
||||
}
|
||||
|
||||
@@ -700,18 +746,4 @@ void createItem(LayoutItem *item, const Span &t)
|
||||
};
|
||||
}
|
||||
|
||||
LayoutItem hr()
|
||||
{
|
||||
LayoutItem item;
|
||||
item.onAdd = [](LayoutBuilder &builder) { doAddWidget(builder, createHr()); };
|
||||
return item;
|
||||
}
|
||||
|
||||
LayoutItem st()
|
||||
{
|
||||
LayoutItem item;
|
||||
item.onAdd = [](LayoutBuilder &builder) { doAddStretch(builder, Stretch(1)); };
|
||||
return item;
|
||||
}
|
||||
|
||||
} // Layouting
|
||||
|
||||
@@ -24,12 +24,6 @@ QT_END_NAMESPACE
|
||||
|
||||
namespace Layouting {
|
||||
|
||||
enum AttachType {
|
||||
WithMargins,
|
||||
WithoutMargins,
|
||||
WithFormAlignment, // Handle Grid similar to QFormLayout, i.e. use special alignment for the first column on Mac
|
||||
};
|
||||
|
||||
class LayoutBuilder;
|
||||
class LayoutItem;
|
||||
class Span;
|
||||
@@ -88,8 +82,8 @@ public:
|
||||
createItem(this, t);
|
||||
}
|
||||
|
||||
void attachTo(QWidget *w, AttachType attachType = WithMargins) const;
|
||||
QWidget *emerge(AttachType attachType = WithMargins);
|
||||
void attachTo(QWidget *w) const;
|
||||
QWidget *emerge();
|
||||
|
||||
void addItem(const LayoutItem &item);
|
||||
void addItems(const LayoutItems &items);
|
||||
@@ -193,6 +187,9 @@ QTCREATOR_UTILS_EXPORT LayoutItem br();
|
||||
QTCREATOR_UTILS_EXPORT LayoutItem st();
|
||||
QTCREATOR_UTILS_EXPORT LayoutItem empty();
|
||||
QTCREATOR_UTILS_EXPORT LayoutItem hr();
|
||||
QTCREATOR_UTILS_EXPORT LayoutItem noMargin();
|
||||
QTCREATOR_UTILS_EXPORT LayoutItem normalMargin();
|
||||
QTCREATOR_UTILS_EXPORT LayoutItem withFormAlignment();
|
||||
|
||||
// "Properties"
|
||||
|
||||
@@ -238,7 +235,7 @@ public:
|
||||
class QTCREATOR_UTILS_EXPORT LayoutExtender : public LayoutBuilder
|
||||
{
|
||||
public:
|
||||
explicit LayoutExtender(QLayout *layout, AttachType attachType);
|
||||
explicit LayoutExtender(QLayout *layout);
|
||||
~LayoutExtender();
|
||||
};
|
||||
|
||||
|
||||
@@ -137,8 +137,9 @@ AndroidBuildApkWidget::AndroidBuildApkWidget(AndroidBuildApkStep *step)
|
||||
createSignPackageGroup(),
|
||||
createApplicationGroup(),
|
||||
createAdvancedGroup(),
|
||||
createAdditionalLibrariesGroup()
|
||||
}.attachTo(this, WithoutMargins);
|
||||
createAdditionalLibrariesGroup(),
|
||||
noMargin
|
||||
}.attachTo(this);
|
||||
|
||||
connect(m_step->buildConfiguration(), &BuildConfiguration::buildTypeChanged,
|
||||
this, &AndroidBuildApkWidget::updateSigningWarning);
|
||||
|
||||
@@ -606,7 +606,8 @@ QWidget *AndroidDeployQtStep::createConfigWidget()
|
||||
Layouting::Form builder;
|
||||
builder.addRow({m_uninstallPreviousPackage});
|
||||
builder.addRow({installCustomApkButton});
|
||||
builder.attachTo(widget, Layouting::WithoutMargins);
|
||||
builder.addItem(Layouting::noMargin);
|
||||
builder.attachTo(widget);
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
@@ -141,14 +141,16 @@ AndroidSdkManagerWidget::AndroidSdkManagerWidget(AndroidConfig &config,
|
||||
}
|
||||
},
|
||||
optionsButton
|
||||
}
|
||||
}.attachTo(m_packagesStack, WithoutMargins);
|
||||
},
|
||||
noMargin
|
||||
}.attachTo(m_packagesStack);
|
||||
|
||||
Column {
|
||||
m_outputEdit,
|
||||
Row { m_sdkLicenseLabel, m_sdkLicenseButtonBox },
|
||||
m_operationProgress,
|
||||
}.attachTo(m_outputStack, WithoutMargins);
|
||||
noMargin
|
||||
}.attachTo(m_outputStack);
|
||||
|
||||
Column {
|
||||
m_viewStack,
|
||||
|
||||
@@ -65,8 +65,9 @@ public:
|
||||
Tr::tr("Email:"), emailLineEdit, br,
|
||||
Tr::tr("Fixed bugs:"), fixedBugsLineEdit
|
||||
}
|
||||
}
|
||||
}.attachTo(this, WithoutMargins);
|
||||
},
|
||||
noMargin
|
||||
}.attachTo(this);
|
||||
}
|
||||
|
||||
QLineEdit *branchLineEdit;
|
||||
|
||||
@@ -90,8 +90,9 @@ ArtisticStyleOptionsPageWidget::ArtisticStyleOptionsPageWidget(ArtisticStyleSett
|
||||
m_useOtherFiles,
|
||||
Row { m_useSpecificConfigFile, m_specificConfigFile },
|
||||
m_useHomeFile,
|
||||
Row { m_useCustomStyle, m_configurations }
|
||||
}.attachTo(options, WithoutMargins);
|
||||
Row { m_useCustomStyle, m_configurations },
|
||||
noMargin,
|
||||
}.attachTo(options);
|
||||
|
||||
Column {
|
||||
Group {
|
||||
|
||||
@@ -32,8 +32,9 @@ ConfigurationPanel::ConfigurationPanel(QWidget *parent)
|
||||
m_configurations,
|
||||
m_edit,
|
||||
m_remove,
|
||||
add
|
||||
}.attachTo(this, WithoutMargins);
|
||||
add,
|
||||
noMargin,
|
||||
}.attachTo(this);
|
||||
|
||||
connect(add, &QPushButton::clicked, this, &ConfigurationPanel::add);
|
||||
connect(m_edit, &QPushButton::clicked, this, &ConfigurationPanel::edit);
|
||||
|
||||
@@ -60,8 +60,9 @@ ClangFormatGlobalConfigWidget::ClangFormatGlobalConfigWidget(
|
||||
};
|
||||
|
||||
Column {
|
||||
globalSettingsGroupBox
|
||||
}.attachTo(this, Layouting::WithoutMargins);
|
||||
globalSettingsGroupBox,
|
||||
noMargin
|
||||
}.attachTo(this);
|
||||
|
||||
initCheckBoxes();
|
||||
initIndentationOrFormattingCombobox();
|
||||
|
||||
@@ -84,8 +84,9 @@ ClangToolsProjectSettingsWidget::ClangToolsProjectSettingsWidget(ProjectExplorer
|
||||
st
|
||||
}
|
||||
}
|
||||
}
|
||||
}.attachTo(this, WithoutMargins);
|
||||
},
|
||||
noMargin
|
||||
}.attachTo(this);
|
||||
|
||||
setUseGlobalSettings(m_projectSettings->useGlobalSettings());
|
||||
onGlobalCustomChanged(useGlobalSettings());
|
||||
|
||||
@@ -90,13 +90,15 @@ public:
|
||||
using namespace Layouting;
|
||||
|
||||
Column {
|
||||
checksPrefixesTree
|
||||
}.attachTo(checksPage, WithoutMargins);
|
||||
checksPrefixesTree,
|
||||
noMargin
|
||||
}.attachTo(checksPage);
|
||||
|
||||
Column {
|
||||
invalidExecutableLabel,
|
||||
st,
|
||||
}.attachTo(invalidExecutablePage, WithoutMargins);
|
||||
noMargin
|
||||
}.attachTo(invalidExecutablePage);
|
||||
|
||||
Column {
|
||||
Row { plainTextEditButton, filterLineEdit },
|
||||
@@ -169,13 +171,15 @@ public:
|
||||
|
||||
Column {
|
||||
label,
|
||||
Row { groupBox, checksGroupBox }
|
||||
}.attachTo(checksPage, WithoutMargins);
|
||||
Row { groupBox, checksGroupBox },
|
||||
noMargin
|
||||
}.attachTo(checksPage);
|
||||
|
||||
Column {
|
||||
invalidExecutableLabel,
|
||||
st
|
||||
}.attachTo(invalidExecutablePage, WithoutMargins);
|
||||
st,
|
||||
noMargin
|
||||
}.attachTo(invalidExecutablePage);
|
||||
|
||||
Column {
|
||||
enableLowerLevelsCheckBox,
|
||||
|
||||
@@ -50,8 +50,9 @@ RunSettingsWidget::RunSettingsWidget(QWidget *parent)
|
||||
m_analyzeOpenFiles,
|
||||
Row { Tr::tr("Parallel jobs:"), m_parallelJobsSpinBox, st },
|
||||
}
|
||||
}
|
||||
}.attachTo(this, WithoutMargins);
|
||||
},
|
||||
noMargin
|
||||
}.attachTo(this);
|
||||
}
|
||||
|
||||
RunSettingsWidget::~RunSettingsWidget() = default;
|
||||
|
||||
@@ -109,8 +109,8 @@ SettingsPageWidget::SettingsPageWidget()
|
||||
using namespace Layouting;
|
||||
|
||||
Form {
|
||||
Tr::tr("Arg&uments:"), diffArgsEdit
|
||||
}.attachTo(diffWidget, WithoutMargins);
|
||||
Tr::tr("Arg&uments:"), diffArgsEdit, noMargin
|
||||
}.attachTo(diffWidget);
|
||||
|
||||
Column {
|
||||
Group {
|
||||
|
||||
@@ -354,12 +354,14 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildSystem *bs) :
|
||||
}
|
||||
},
|
||||
configureEnvironmentAspectWidget
|
||||
}
|
||||
}.attachTo(details, WithoutMargins);
|
||||
},
|
||||
noMargin
|
||||
}.attachTo(details);
|
||||
|
||||
Column {
|
||||
m_configureDetailsWidget,
|
||||
}.attachTo(this, WithoutMargins);
|
||||
noMargin
|
||||
}.attachTo(this);
|
||||
|
||||
updateAdvancedCheckBox();
|
||||
setError(m_buildSystem->error());
|
||||
|
||||
@@ -577,7 +577,8 @@ QWidget *CMakeBuildStep::createConfigWidget()
|
||||
if (!isCleanStep() && !m_buildPreset.isEmpty())
|
||||
createAndAddEnvironmentWidgets(builder);
|
||||
|
||||
auto widget = builder.emerge(Layouting::WithoutMargins);
|
||||
builder.addItem(Layouting::noMargin);
|
||||
auto widget = builder.emerge();
|
||||
|
||||
updateDetails();
|
||||
|
||||
|
||||
@@ -108,8 +108,9 @@ QWidget *CMakeInstallStep::createConfigWidget()
|
||||
|
||||
Layouting::Form builder;
|
||||
builder.addRow({m_cmakeArguments});
|
||||
builder.addItem(Layouting::noMargin);
|
||||
|
||||
auto widget = builder.emerge(Layouting::WithoutMargins);
|
||||
auto widget = builder.emerge();
|
||||
|
||||
updateDetails();
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ AddToVcsDialog::AddToVcsDialog(QWidget *parent,
|
||||
filesListWidget->setSelectionMode(QAbstractItemView::NoSelection);
|
||||
filesListWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
|
||||
QWidget *scrollAreaWidgetContents = Column{filesListWidget}.emerge(WithoutMargins);
|
||||
QWidget *scrollAreaWidgetContents = Column{filesListWidget, noMargin}.emerge();
|
||||
scrollAreaWidgetContents->setGeometry({0, 0, 341, 300});
|
||||
|
||||
auto scrollArea = new QScrollArea;
|
||||
|
||||
@@ -564,11 +564,11 @@ ExternalToolConfig::ExternalToolConfig()
|
||||
Tr::tr("Environment:"), m_environmentLabel, environmentButton, br,
|
||||
empty, m_modifiesDocumentCheckbox, br,
|
||||
inputLabel, m_inputText
|
||||
}.attachTo(m_infoWidget, WithMargins);
|
||||
}.attachTo(m_infoWidget);
|
||||
|
||||
Column {
|
||||
m_infoWidget
|
||||
}.attachTo(scrollAreaWidgetContents, WithoutMargins);
|
||||
m_infoWidget, noMargin
|
||||
}.attachTo(scrollAreaWidgetContents);
|
||||
|
||||
Row {
|
||||
Column {
|
||||
|
||||
@@ -422,8 +422,12 @@ void ReadOnlyFilesDialogPrivate::initDialog(const FilePaths &filePaths)
|
||||
|
||||
using namespace Layouting;
|
||||
|
||||
QWidget *setAllWidget = Row{Tr::tr("Select all, if possible: "), m_setAll, st}.emerge(
|
||||
WithoutMargins);
|
||||
QWidget *setAllWidget = Row {
|
||||
Tr::tr("Select all, if possible: "),
|
||||
m_setAll,
|
||||
st,
|
||||
noMargin
|
||||
}.emerge();
|
||||
|
||||
// clang-format off
|
||||
Column {
|
||||
|
||||
@@ -109,7 +109,8 @@ FindToolWindow::FindToolWindow(QWidget *parent)
|
||||
m_wholeWords,
|
||||
m_regExp,
|
||||
st,
|
||||
}.attachTo(m_optionsWidget, WithoutMargins);
|
||||
noMargin
|
||||
}.attachTo(m_optionsWidget);
|
||||
|
||||
Grid {
|
||||
label, m_filterList, br,
|
||||
|
||||
@@ -796,8 +796,13 @@ ListModel *SectionedGridView::addSection(const Section §ion, const QList<Lis
|
||||
}
|
||||
connect(seeAllLink, &QLabel::linkActivated, this, [this, section] { zoomInSection(section); });
|
||||
using namespace Layouting;
|
||||
QWidget *sectionLabel = Row{section.name, createSeparator(this), seeAllLink, Space(HSpacing)}
|
||||
.emerge(Layouting::WithoutMargins);
|
||||
QWidget *sectionLabel = Row {
|
||||
section.name,
|
||||
createSeparator(this),
|
||||
seeAllLink,
|
||||
Space(HSpacing),
|
||||
noMargin
|
||||
}.emerge();
|
||||
m_sectionLabels.append(sectionLabel);
|
||||
sectionLabel->setContentsMargins(0, ItemGap, 0, 0);
|
||||
sectionLabel->setFont(Core::WelcomePageHelpers::brandFont());
|
||||
@@ -849,8 +854,13 @@ void SectionedGridView::zoomInSection(const Section §ion)
|
||||
setCurrentIndex(0);
|
||||
});
|
||||
using namespace Layouting;
|
||||
QWidget *sectionLabel = Row{section.name, createSeparator(this), backLink, Space(HSpacing)}
|
||||
.emerge(Layouting::WithoutMargins);
|
||||
QWidget *sectionLabel = Row {
|
||||
section.name,
|
||||
createSeparator(this),
|
||||
backLink,
|
||||
Space(HSpacing),
|
||||
noMargin
|
||||
}.emerge();
|
||||
sectionLabel->setContentsMargins(0, ItemGap, 0, 0);
|
||||
sectionLabel->setFont(Core::WelcomePageHelpers::brandFont());
|
||||
|
||||
|
||||
@@ -1485,7 +1485,8 @@ CppCodeModelInspectorDialog::CppCodeModelInspectorDialog(QWidget *parent)
|
||||
Column {
|
||||
Form { QString("Sn&apshot:"), m_snapshotSelector },
|
||||
m_snapshotView,
|
||||
}.emerge(Layouting::WithoutMargins),
|
||||
noMargin,
|
||||
}.emerge(),
|
||||
docTab,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ LineCountSpinBox::LineCountSpinBox(QWidget *parent)
|
||||
m_unitLabel = new QLabel(Tr::tr("lines"));
|
||||
|
||||
using namespace Layouting;
|
||||
Row { m_checkBox, m_opLabel, m_spinBox, m_unitLabel, }.attachTo(this, WithoutMargins);
|
||||
Row { m_checkBox, m_opLabel, m_spinBox, m_unitLabel, noMargin }.attachTo(this);
|
||||
|
||||
auto handleChange = [this] {
|
||||
updateFields();
|
||||
@@ -220,7 +220,8 @@ e.g. name = "m_test_foo_":
|
||||
Tr::tr("Inside class:"), Tr::tr("Default"), Tr::tr("Default"), br,
|
||||
Tr::tr("Outside class:"), m_lines_setterOutsideClass, m_lines_getterOutsideClass, br,
|
||||
Tr::tr("In .cpp file:"), m_lines_setterInCppFile, m_lines_getterInCppFile, br,
|
||||
}.attachTo(functionLocationsGrid, WithoutMargins);
|
||||
noMargin,
|
||||
}.attachTo(functionLocationsGrid);
|
||||
|
||||
if (QGridLayout *gl = qobject_cast<QGridLayout*>(functionLocationsGrid->layout()))
|
||||
gl->setHorizontalSpacing(48);
|
||||
|
||||
@@ -67,7 +67,8 @@ DebuggerRunConfigurationAspect::DebuggerRunConfigurationAspect(Target *target)
|
||||
details->setState(DetailsWidget::Expanded);
|
||||
auto innerPane = new QWidget;
|
||||
details->setWidget(innerPane);
|
||||
builder.attachTo(innerPane, Layouting::WithoutMargins);
|
||||
builder.addItem(Layouting::noMargin);
|
||||
builder.attachTo(innerPane);
|
||||
|
||||
const auto setSummaryText = [this, details] {
|
||||
QStringList items;
|
||||
|
||||
@@ -73,7 +73,8 @@ NewClassWidget::NewClassWidget(QWidget *parent) :
|
||||
Tr::tr("&Source file:"), d->m_sourceFileLineEdit, br,
|
||||
Tr::tr("&Form file:"), d->m_formFileLineEdit, br,
|
||||
Tr::tr("&Path:"), d->m_pathChooser, br,
|
||||
}.attachTo(this, WithoutMargins);
|
||||
noMargin
|
||||
}.attachTo(this);
|
||||
|
||||
connect(d->m_classLineEdit, &ClassNameValidatingLineEdit::updateFileName,
|
||||
this, &NewClassWidget::slotUpdateFileNames);
|
||||
|
||||
@@ -247,7 +247,8 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
|
||||
m_pathsListEdit,
|
||||
}, br,
|
||||
(dockerDevice->isAutoDetected() ? Column {} : std::move(detectionControls)),
|
||||
}.attachTo(this, WithoutMargins);
|
||||
noMargin,
|
||||
}.attachTo(this);
|
||||
// clang-format on
|
||||
|
||||
searchDirsLineEdit->setVisible(false);
|
||||
|
||||
@@ -120,8 +120,9 @@ FossilCommitWidget::FossilCommitWidget() : m_commitPanel(new QWidget)
|
||||
Tr::tr("Tags:"), m_tagsLineEdit, br,
|
||||
Tr::tr("Author:"), m_authorLineEdit, st,
|
||||
}
|
||||
}
|
||||
}.attachTo(m_commitPanel, WithoutMargins);
|
||||
},
|
||||
noMargin
|
||||
}.attachTo(m_commitPanel);
|
||||
|
||||
insertTopWidget(m_commitPanel);
|
||||
new FossilSubmitHighlighter(descriptionEdit());
|
||||
|
||||
@@ -81,7 +81,8 @@ public:
|
||||
}
|
||||
},
|
||||
editGroup,
|
||||
}.attachTo(this, WithoutMargins);
|
||||
noMargin,
|
||||
}.attachTo(this);
|
||||
}
|
||||
|
||||
QLabel *repositoryLabel;
|
||||
|
||||
@@ -101,9 +101,10 @@ GitLabServerWidget::GitLabServerWidget(Mode m, QWidget *parent)
|
||||
m_description,
|
||||
m_token,
|
||||
m_port,
|
||||
m_secure
|
||||
m_secure,
|
||||
m == Edit ? normalMargin : noMargin
|
||||
},
|
||||
}.attachTo(this, m == Edit ? WithMargins : WithoutMargins);
|
||||
}.attachTo(this);
|
||||
}
|
||||
|
||||
GitLabServer GitLabServerWidget::gitLabServer() const
|
||||
|
||||
@@ -119,8 +119,9 @@ public:
|
||||
Tr::tr("Email:"), m_emailLineEdit,
|
||||
},
|
||||
}
|
||||
}
|
||||
}.attachTo(this, Layouting::WithoutMargins);
|
||||
},
|
||||
noMargin
|
||||
}.attachTo(this);
|
||||
}
|
||||
|
||||
QLabel *m_repositoryLabel;
|
||||
|
||||
@@ -30,8 +30,8 @@ RevertDialog::RevertDialog(QWidget *parent)
|
||||
using namespace Layouting;
|
||||
|
||||
Form {
|
||||
Tr::tr("Revision:"), m_revisionLineEdit,
|
||||
}.attachTo(groupBox, WithMargins);
|
||||
Tr::tr("Revision:"), m_revisionLineEdit, normalMargin
|
||||
}.attachTo(groupBox);
|
||||
|
||||
Column {
|
||||
groupBox,
|
||||
|
||||
@@ -67,16 +67,18 @@ MesonBuildSettingsWidget::MesonBuildSettingsWidget(MesonBuildConfiguration *buil
|
||||
buildDirWidget,
|
||||
optionsFilterLineEdit,
|
||||
optionsTreeView,
|
||||
}.attachTo(details, WithoutMargins);
|
||||
noMargin
|
||||
}.attachTo(details);
|
||||
|
||||
Column {
|
||||
container,
|
||||
Row { configureButton, wipeButton, }
|
||||
}.attachTo(this, WithoutMargins);
|
||||
Row { configureButton, wipeButton, noMargin }
|
||||
}.attachTo(this);
|
||||
|
||||
Form {
|
||||
buildCfg->buildDirectoryAspect(),
|
||||
}.attachTo(buildDirWidget, WithoutMargins);
|
||||
noMargin
|
||||
}.attachTo(buildDirWidget);
|
||||
|
||||
parametersLineEdit->setText(buildCfg->parameters());
|
||||
optionsFilterLineEdit->setFiltering(true);
|
||||
|
||||
@@ -29,7 +29,8 @@ ToolItemSettings::ToolItemSettings(QWidget *parent)
|
||||
Form {
|
||||
Tr::tr("Name:"), m_mesonNameLineEdit, br,
|
||||
Tr::tr("Path:"), m_mesonPathChooser, br,
|
||||
}.attachTo(this, WithoutMargins);
|
||||
noMargin
|
||||
}.attachTo(this);
|
||||
|
||||
connect(m_mesonPathChooser, &PathChooser::rawPathChanged, this, &ToolItemSettings::store);
|
||||
connect(m_mesonNameLineEdit, &QLineEdit::textChanged, this, &ToolItemSettings::store);
|
||||
|
||||
@@ -88,8 +88,9 @@ QWidget *NimbleTaskStep::createConfigWidget()
|
||||
using namespace Layouting;
|
||||
auto widget = Form {
|
||||
m_taskArgs,
|
||||
Tr::tr("Tasks:"), taskList
|
||||
}.emerge(WithoutMargins);
|
||||
Tr::tr("Tasks:"), taskList,
|
||||
noMargin
|
||||
}.emerge();
|
||||
|
||||
auto buildSystem = dynamic_cast<NimbleBuildSystem *>(this->buildSystem());
|
||||
QTC_ASSERT(buildSystem, return widget);
|
||||
|
||||
@@ -44,7 +44,8 @@ NimCodeStylePreferencesWidget::NimCodeStylePreferencesWidget(ICodeStylePreferenc
|
||||
st,
|
||||
},
|
||||
m_previewTextEdit,
|
||||
}.attachTo(this, WithoutMargins);
|
||||
noMargin,
|
||||
}.attachTo(this);
|
||||
|
||||
decorateEditor(TextEditorSettings::fontSettings());
|
||||
connect(TextEditorSettings::instance(), &TextEditorSettings::fontSettingsChanged,
|
||||
|
||||
@@ -327,7 +327,8 @@ NamedWidget *BuildConfiguration::createConfigWidget()
|
||||
if (aspect->isVisible())
|
||||
form.addItem(aspect);
|
||||
}
|
||||
form.attachTo(widget, Layouting::WithoutMargins);
|
||||
form.addItem(Layouting::noMargin);
|
||||
form.attachTo(widget);
|
||||
|
||||
return named;
|
||||
}
|
||||
|
||||
@@ -165,7 +165,8 @@ QWidget *BuildStep::createConfigWidget()
|
||||
if (aspect->isVisible())
|
||||
form.addItem(aspect);
|
||||
}
|
||||
auto widget = form.emerge(Layouting::WithoutMargins);
|
||||
form.addItem(Layouting::noMargin);
|
||||
auto widget = form.emerge();
|
||||
|
||||
if (m_addMacroExpander)
|
||||
VariableChooser::addSupportForChildWidgets(widget, macroExpander());
|
||||
|
||||
@@ -52,8 +52,9 @@ CodeStyleSettingsWidget::CodeStyleSettingsWidget(Project *project)
|
||||
|
||||
Column {
|
||||
Row { new QLabel(Tr::tr("Language:")), languageComboBox, st },
|
||||
stackedWidget
|
||||
}.attachTo(this, WithoutMargins);
|
||||
stackedWidget,
|
||||
noMargin
|
||||
}.attachTo(this);
|
||||
}
|
||||
|
||||
} // ProjectExplorer::Internal
|
||||
|
||||
@@ -63,7 +63,8 @@ EditorSettingsWidget::EditorSettingsWidget(Project *project) : m_project(project
|
||||
m_displaySettings,
|
||||
m_behaviorSettings,
|
||||
st,
|
||||
}.attachTo(this, WithoutMargins);
|
||||
noMargin
|
||||
}.attachTo(this);
|
||||
|
||||
const EditorConfiguration *config = m_project->editorConfiguration();
|
||||
settingsToUi(config);
|
||||
|
||||
@@ -756,7 +756,7 @@ void KitAspectWidget::addToLayoutWithLabel(QWidget *parent)
|
||||
emit labelLinkActivated(link);
|
||||
});
|
||||
|
||||
Layouting::LayoutExtender builder(parent->layout(), Layouting::WithFormAlignment);
|
||||
Layouting::LayoutExtender builder(parent->layout());
|
||||
builder.addItems({label, Layouting::br});
|
||||
addToLayout(builder);
|
||||
}
|
||||
|
||||
@@ -67,9 +67,11 @@ KitManagerConfigWidget::KitManagerConfigWidget(Kit *k, bool &isDefaultKit, bool
|
||||
|
||||
using namespace Layouting;
|
||||
Grid {
|
||||
withFormAlignment,
|
||||
label, m_nameEdit, m_iconButton, br,
|
||||
fsLabel, m_fileSystemFriendlyNameLineEdit
|
||||
}.attachTo(this, WithFormAlignment);
|
||||
fsLabel, m_fileSystemFriendlyNameLineEdit,
|
||||
noMargin
|
||||
}.attachTo(this);
|
||||
|
||||
m_iconButton->setToolTip(Tr::tr("Kit icon."));
|
||||
auto setIconAction = new QAction(Tr::tr("Select Icon..."), this);
|
||||
|
||||
@@ -324,8 +324,9 @@ QWidget *MakeStep::createConfigWidget()
|
||||
if (m_disablingForSubDirsSupported)
|
||||
builder.addRow({m_disabledForSubdirsAspect});
|
||||
builder.addRow({m_buildTargetsAspect});
|
||||
builder.addItem(Layouting::noMargin);
|
||||
|
||||
auto widget = builder.emerge(Layouting::WithoutMargins);
|
||||
auto widget = builder.emerge();
|
||||
|
||||
VariableChooser::addSupportForChildWidgets(widget, macroExpander());
|
||||
|
||||
|
||||
@@ -221,8 +221,8 @@ QWidget *RunConfiguration::createConfigurationWidget()
|
||||
if (aspect->isVisible())
|
||||
form.addItem(aspect);
|
||||
}
|
||||
|
||||
auto widget = form.emerge(Layouting::WithoutMargins);
|
||||
form.addItem(Layouting::noMargin);
|
||||
auto widget = form.emerge();
|
||||
|
||||
VariableChooser::addSupportForChildWidgets(widget, &m_expander);
|
||||
|
||||
|
||||
@@ -96,8 +96,9 @@ public:
|
||||
|
||||
Form {
|
||||
Tr::tr("Name:"), m_name, br,
|
||||
Tr::tr("Executable"), m_executable
|
||||
}.attachTo(this, WithoutMargins);
|
||||
Tr::tr("Executable"), m_executable,
|
||||
noMargin
|
||||
}.attachTo(this);
|
||||
}
|
||||
|
||||
void updateInterpreter(const Interpreter &interpreter)
|
||||
|
||||
@@ -118,8 +118,9 @@ PythonWizardPage::PythonWizardPage(const QList<QPair<QString, QVariant>> &pySide
|
||||
m_interpreter, br,
|
||||
m_createVenv, br,
|
||||
m_venvPath, br,
|
||||
m_stateLabel, br
|
||||
}.attachTo(this, WithoutMargins);
|
||||
m_stateLabel, br,
|
||||
noMargin
|
||||
}.attachTo(this);
|
||||
}
|
||||
|
||||
void PythonWizardPage::initializePage()
|
||||
|
||||
@@ -677,7 +677,8 @@ QbsBuildStepConfigWidget::QbsBuildStepConfigWidget(QbsBuildStep *step)
|
||||
|
||||
QbsProjectManager::Tr::tr("Installation directory:"), installDirChooser, br,
|
||||
m_qbsStep->m_commandLine, br,
|
||||
}.attachTo(this, Layouting::WithoutMargins);
|
||||
noMargin,
|
||||
}.attachTo(this);
|
||||
|
||||
propertyEdit->setToolTip(QbsProjectManager::Tr::tr("Properties to pass to the project."));
|
||||
defaultInstallDirCheckBox->setText(QbsProjectManager::Tr::tr("Use default location"));
|
||||
|
||||
@@ -485,7 +485,8 @@ QWidget *QMakeStep::createConfigWidget()
|
||||
builder.addRow({m_userArgs});
|
||||
builder.addRow({m_effectiveCall});
|
||||
builder.addRow({abisLabel, abisListWidget});
|
||||
auto widget = builder.emerge(Layouting::WithoutMargins);
|
||||
builder.addItem(Layouting::noMargin);
|
||||
auto widget = builder.emerge();
|
||||
|
||||
qmakeBuildConfigChanged();
|
||||
|
||||
|
||||
@@ -54,7 +54,8 @@ QmlJSCodeStylePreferencesWidget::QmlJSCodeStylePreferencesWidget(
|
||||
st,
|
||||
},
|
||||
m_previewTextEdit,
|
||||
}.attachTo(this, WithoutMargins);
|
||||
noMargin
|
||||
}.attachTo(this);
|
||||
|
||||
connect(TextEditorSettings::instance(), &TextEditorSettings::fontSettingsChanged,
|
||||
this, &QmlJSCodeStylePreferencesWidget::decorateEditor);
|
||||
|
||||
@@ -26,8 +26,9 @@ QmlJSCodeStyleSettingsWidget::QmlJSCodeStyleSettingsWidget(QWidget *parent)
|
||||
Form {
|
||||
Tr::tr("&Line length:"), m_lineLengthSpinBox, br,
|
||||
}
|
||||
}
|
||||
}.attachTo(this, WithoutMargins);
|
||||
},
|
||||
noMargin
|
||||
}.attachTo(this);
|
||||
|
||||
connect(m_lineLengthSpinBox, &QSpinBox::valueChanged,
|
||||
this, &QmlJSCodeStyleSettingsWidget::slotSettingsChanged);
|
||||
|
||||
@@ -268,8 +268,9 @@ QtOptionsPageWidget::QtOptionsPageWidget()
|
||||
Form {
|
||||
Tr::tr("Name:"), m_nameEdit, br,
|
||||
Tr::tr("qmake path:"), Row { m_qmakePath, m_editPathPushButton }, br,
|
||||
Span(2, m_errorLabel)
|
||||
}.attachTo(versionInfoWidget, WithoutMargins);
|
||||
Span(2, m_errorLabel),
|
||||
noMargin
|
||||
}.attachTo(versionInfoWidget);
|
||||
// clang-format on
|
||||
|
||||
m_formLayout = qobject_cast<QFormLayout*>(versionInfoWidget->layout());
|
||||
|
||||
@@ -35,7 +35,7 @@ ColorPicker::ColorPicker(const QString &key, QWidget *parent)
|
||||
m_lastUsedColorContainer->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
using namespace Layouting;
|
||||
Grid colorGrid;
|
||||
Grid colorGrid{noMargin};
|
||||
for (int i = 0; i < colors.count(); ++i) {
|
||||
QWidget *button = createButton(colors[i]);
|
||||
colorGrid.addItem(button);
|
||||
@@ -46,7 +46,7 @@ ColorPicker::ColorPicker(const QString &key, QWidget *parent)
|
||||
QSizePolicy::MinimumExpanding,
|
||||
QSizePolicy::Preferred));
|
||||
}
|
||||
colorGrid.attachTo(basicColorContentFrame, WithoutMargins);
|
||||
colorGrid.attachTo(basicColorContentFrame);
|
||||
Column {
|
||||
Tr::tr("Basic Colors"),
|
||||
basicColorContentFrame,
|
||||
|
||||
@@ -44,7 +44,8 @@ ColorSettings::ColorSettings(QWidget *parent)
|
||||
removeTheme,
|
||||
},
|
||||
m_colorThemeView,
|
||||
}.attachTo(this, WithoutMargins);
|
||||
noMargin
|
||||
}.attachTo(this);
|
||||
|
||||
connect(m_comboColorThemes, &QComboBox::currentIndexChanged,
|
||||
this, &ColorSettings::selectTheme);
|
||||
|
||||
@@ -36,7 +36,8 @@ NavigatorSlider::NavigatorSlider(QWidget *parent)
|
||||
m_slider,
|
||||
zoomIn,
|
||||
Space(20),
|
||||
}.attachTo(this, WithoutMargins);
|
||||
noMargin,
|
||||
}.attachTo(this);
|
||||
|
||||
connect(zoomOut, &QToolButton::clicked, this, &NavigatorSlider::zoomOut);
|
||||
connect(zoomIn, &QToolButton::clicked, this, &NavigatorSlider::zoomIn);
|
||||
|
||||
@@ -50,7 +50,8 @@ Search::Search(QWidget *parent)
|
||||
spacing(0),
|
||||
m_searchEdit,
|
||||
m_searchView,
|
||||
}.attachTo(this, WithoutMargins);
|
||||
noMargin
|
||||
}.attachTo(this);
|
||||
|
||||
connect(m_searchEdit, &Utils::FancyLineEdit::textChanged, this, &Search::setSearchText);
|
||||
connect(m_searchView, &TableView::pressed, this, &Search::rowActivated);
|
||||
|
||||
@@ -33,7 +33,8 @@ ShapesToolbox::ShapesToolbox(QWidget *parent)
|
||||
Column {
|
||||
spacing(0),
|
||||
scrollArea,
|
||||
}.attachTo(this, WithoutMargins);
|
||||
noMargin,
|
||||
}.attachTo(this);
|
||||
}
|
||||
|
||||
void ShapesToolbox::setUIFactory(ScxmlEditor::PluginInterface::ScxmlUiFactory *factory)
|
||||
|
||||
@@ -35,13 +35,15 @@ StateView::StateView(StateItem *state, QWidget *parent)
|
||||
Row {
|
||||
PushButton{ text("Back"), onClicked([this] { closeView(); }, this) },
|
||||
stateNameLabel,
|
||||
}.attachTo(titleBar, WithoutMargins);
|
||||
noMargin
|
||||
}.attachTo(titleBar);
|
||||
|
||||
Column {
|
||||
spacing(0),
|
||||
titleBar,
|
||||
m_graphicsView
|
||||
}.attachTo(this, WithoutMargins);
|
||||
m_graphicsView,
|
||||
noMargin,
|
||||
}.attachTo(this);
|
||||
|
||||
initScene();
|
||||
}
|
||||
|
||||
@@ -140,8 +140,9 @@ Statistics::Statistics(QWidget *parent)
|
||||
Tr::tr("File"), m_fileNameLabel, br,
|
||||
Tr::tr("Time"), m_timeLabel, br,
|
||||
Tr::tr("Max. levels"), m_levels, br,
|
||||
Span(2, m_statisticsView), br
|
||||
}.attachTo(this, WithoutMargins);
|
||||
Span(2, m_statisticsView), br,
|
||||
noMargin
|
||||
}.attachTo(this);
|
||||
}
|
||||
|
||||
void Statistics::setDocument(ScxmlDocument *doc)
|
||||
|
||||
@@ -207,8 +207,9 @@ BehaviorSettingsWidget::BehaviorSettingsWidget(QWidget *parent)
|
||||
|
||||
Row {
|
||||
Column { d->tabPreferencesWidget, d->groupBoxTyping, st },
|
||||
Column { d->groupBoxStorageSettings, d->groupBoxEncodings, d->groupBoxMouse, st }
|
||||
}.attachTo(this, WithoutMargins);
|
||||
Column { d->groupBoxStorageSettings, d->groupBoxEncodings, d->groupBoxMouse, st },
|
||||
noMargin,
|
||||
}.attachTo(this);
|
||||
|
||||
connect(d->cleanWhitespace, &QCheckBox::toggled,
|
||||
d->inEntireDocument, &QCheckBox::setEnabled);
|
||||
|
||||
@@ -29,6 +29,7 @@ CodeStyleEditor::CodeStyleEditor(ICodeStylePreferencesFactory *factory,
|
||||
, m_codeStyle(codeStyle)
|
||||
{
|
||||
m_layout = new QVBoxLayout(this);
|
||||
m_layout->setContentsMargins(0, 0, 0, 0);
|
||||
auto selector = new CodeStyleSelectorWidget(factory, project, this);
|
||||
selector->setCodeStyle(codeStyle);
|
||||
m_additionalGlobalSettingsWidget = factory->createAdditionalGlobalSettings(codeStyle,
|
||||
|
||||
@@ -59,8 +59,8 @@ CodeStyleSelectorWidget::CodeStyleSelectorWidget(ICodeStylePreferencesFactory *f
|
||||
m_exportButton,
|
||||
m_importButton
|
||||
},
|
||||
|
||||
}.attachTo(this, WithoutMargins);
|
||||
noMargin,
|
||||
}.attachTo(this);
|
||||
|
||||
connect(m_delegateComboBox, &QComboBox::activated,
|
||||
this, &CodeStyleSelectorWidget::slotComboBoxActivated);
|
||||
|
||||
@@ -208,7 +208,8 @@ ColorSchemeEdit::ColorSchemeEdit(QWidget *parent) :
|
||||
m_itemList,
|
||||
m_builtinSchemeLabel,
|
||||
m_fontProperties,
|
||||
}.attachTo(this, WithoutMargins);
|
||||
noMargin
|
||||
}.attachTo(this);
|
||||
|
||||
Grid {
|
||||
m_foregroundLabel, m_foregroundToolButton, m_eraseForegroundToolButton, br,
|
||||
|
||||
@@ -208,8 +208,9 @@ SubmitEditorWidget::SubmitEditorWidget() :
|
||||
|
||||
using namespace Layouting;
|
||||
Column {
|
||||
scrollArea
|
||||
}.attachTo(this, WithoutMargins);
|
||||
scrollArea,
|
||||
noMargin
|
||||
}.attachTo(this);
|
||||
|
||||
connect(d->description, &QWidget::customContextMenuRequested,
|
||||
this, &SubmitEditorWidget::editorCustomContextMenuRequested);
|
||||
|
||||
@@ -91,8 +91,9 @@ TaskWidget::TaskWidget()
|
||||
m_infoLabel,
|
||||
m_spinBox,
|
||||
m_checkBox,
|
||||
st
|
||||
}.attachTo(this, WithoutMargins);
|
||||
st,
|
||||
noMargin,
|
||||
}.attachTo(this);
|
||||
}
|
||||
|
||||
void TaskWidget::setBusyTime(int seconds)
|
||||
@@ -145,9 +146,10 @@ GroupWidget::GroupWidget()
|
||||
m_executeCombo,
|
||||
new QLabel("Workflow:"),
|
||||
m_workflowCombo,
|
||||
st
|
||||
st,
|
||||
noMargin
|
||||
}
|
||||
}.attachTo(this, WithoutMargins);
|
||||
}.attachTo(this);
|
||||
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user