forked from qt-creator/qt-creator
Utils: Use 'hr' for horizontal rule in layouts
More HTML-ish. Change-Id: I45d2e474b2810f00422a03603aac125c6f845b81 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -142,6 +142,8 @@ static void addItemToBoxLayout(QBoxLayout *layout, const LayoutBuilder::LayoutIt
|
||||
layout->addStretch(item.specialValue.toInt());
|
||||
} else if (item.specialType == LayoutBuilder::SpecialType::Space) {
|
||||
layout->addSpacing(item.specialValue.toInt());
|
||||
} else if (item.specialType == LayoutBuilder::SpecialType::HorizontalRule) {
|
||||
layout->addWidget(Layouting::createHr());
|
||||
} else if (!item.text.isEmpty()) {
|
||||
layout->addWidget(new QLabel(item.text));
|
||||
} else {
|
||||
@@ -441,6 +443,11 @@ LayoutBuilder::Span::Span(int span_, const LayoutItem &item)
|
||||
span = span_;
|
||||
}
|
||||
|
||||
LayoutBuilder::HorizontalRule::HorizontalRule()
|
||||
{
|
||||
specialType = SpecialType::HorizontalRule;
|
||||
}
|
||||
|
||||
namespace Layouting {
|
||||
|
||||
// "Widgets"
|
||||
@@ -472,12 +479,6 @@ PushButton::PushButton(std::initializer_list<LayoutBuilder::LayoutItem> items)
|
||||
applyItems(widget, items);
|
||||
}
|
||||
|
||||
HorizontalRule::HorizontalRule(std::initializer_list<LayoutItem> items)
|
||||
{
|
||||
widget = createHr();
|
||||
applyItems(widget, items);
|
||||
}
|
||||
|
||||
// "Properties"
|
||||
|
||||
LayoutBuilder::Setter title(const QString &title, BoolAspect *checker)
|
||||
@@ -541,6 +542,7 @@ QWidget *createHr(QWidget *parent)
|
||||
LayoutBuilder::Break br;
|
||||
LayoutBuilder::Stretch st;
|
||||
LayoutBuilder::Space empty(0);
|
||||
LayoutBuilder::HorizontalRule hr;
|
||||
|
||||
} // Layouting
|
||||
} // Utils
|
||||
|
@@ -51,6 +51,7 @@ public:
|
||||
Space,
|
||||
Stretch,
|
||||
Break,
|
||||
HorizontalRule,
|
||||
};
|
||||
|
||||
using Setter = std::function<void(QObject *target)>;
|
||||
@@ -128,6 +129,12 @@ public:
|
||||
Break();
|
||||
};
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT HorizontalRule : public LayoutItem
|
||||
{
|
||||
public:
|
||||
HorizontalRule();
|
||||
};
|
||||
|
||||
protected:
|
||||
explicit LayoutBuilder(); // Adds to existing layout.
|
||||
|
||||
@@ -173,12 +180,6 @@ public:
|
||||
PushButton(std::initializer_list<LayoutItem> items);
|
||||
};
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT HorizontalRule : public LayoutBuilder::LayoutItem
|
||||
{
|
||||
public:
|
||||
HorizontalRule(std::initializer_list<LayoutItem> items);
|
||||
};
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT Column : public LayoutBuilder
|
||||
{
|
||||
public:
|
||||
@@ -213,6 +214,7 @@ using Span = LayoutBuilder::Span;
|
||||
QTCREATOR_UTILS_EXPORT extern LayoutBuilder::Break br;
|
||||
QTCREATOR_UTILS_EXPORT extern LayoutBuilder::Stretch st;
|
||||
QTCREATOR_UTILS_EXPORT extern LayoutBuilder::Space empty;
|
||||
QTCREATOR_UTILS_EXPORT extern LayoutBuilder::HorizontalRule hr;
|
||||
|
||||
} // Layouting
|
||||
} // Utils
|
||||
|
@@ -137,7 +137,7 @@ AndroidSdkManagerWidget::AndroidSdkManagerWidget(AndroidConfig &config,
|
||||
Column {
|
||||
Row { tr("Channel:"), channelCheckbox },
|
||||
obsoleteCheckBox,
|
||||
HorizontalRule {},
|
||||
hr,
|
||||
showAvailableRadio,
|
||||
showInstalledRadio,
|
||||
showAllRadio,
|
||||
|
@@ -116,7 +116,7 @@ IosSettingsWidget::IosSettingsWidget()
|
||||
st
|
||||
},
|
||||
},
|
||||
HorizontalRule {},
|
||||
hr,
|
||||
Row { tr("Screenshot directory:"), m_pathWidget }
|
||||
}
|
||||
}
|
||||
|
@@ -57,7 +57,7 @@ PerfLoadDialog::PerfLoadDialog(QWidget *parent)
|
||||
label3, Span(2, m_kitChooser)
|
||||
},
|
||||
st,
|
||||
HorizontalRule {},
|
||||
hr,
|
||||
buttonBox
|
||||
}.attachTo(this);
|
||||
|
||||
|
@@ -152,7 +152,7 @@ SessionDialog::SessionDialog(QWidget *parent) : QDialog(parent)
|
||||
}
|
||||
},
|
||||
m_autoLoadCheckBox,
|
||||
HorizontalRule {},
|
||||
hr,
|
||||
Row { whatsASessionLabel, buttonBox },
|
||||
}.attachTo(this);
|
||||
|
||||
|
@@ -140,7 +140,7 @@ QbsProfilesSettingsWidget::QbsProfilesSettingsWidget()
|
||||
tr("Kit:"), m_kitsComboBox, br,
|
||||
tr("Associated profile:"), m_profileValueLabel, br,
|
||||
},
|
||||
HorizontalRule {},
|
||||
hr,
|
||||
tr("Profile properties:"),
|
||||
Row {
|
||||
m_propertiesView,
|
||||
|
@@ -79,7 +79,7 @@ BookmarkDialog::BookmarkDialog(BookmarkManager *manager, const QString &title,
|
||||
tr("Bookmark:"), m_bookmarkEdit, br,
|
||||
tr("Add in folder:"), m_bookmarkFolders, br,
|
||||
},
|
||||
Row { m_toolButton, HorizontalRule {}, },
|
||||
Row { m_toolButton, hr },
|
||||
m_treeView,
|
||||
Row { m_newFolderButton, m_buttonBox, }
|
||||
}.attachTo(this);
|
||||
|
Reference in New Issue
Block a user