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
|
||||
|
||||
Reference in New Issue
Block a user