forked from qt-creator/qt-creator
Utils: Add "Layouting::HorizontalRule" LayoutItem
We have many horizontal separator lines in the UI, which are each time repetitively created from a QFrame with some flags set. With the .ui inlining, we will have more of these separators coming. This change intoduces a Layouting::HorizontalRule LayoutItem and replaces various existing QFarme separators with it. Change-Id: I60bad89e2a2b777fbd2f9d0cf872af81e41dcfd7 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -472,6 +472,12 @@ 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)
|
||||
@@ -524,6 +530,14 @@ LayoutBuilder::Setter tooltip(const QString &toolTip)
|
||||
};
|
||||
}
|
||||
|
||||
QWidget *createHr(QWidget *parent)
|
||||
{
|
||||
auto frame = new QFrame(parent);
|
||||
frame->setFrameShape(QFrame::HLine);
|
||||
frame->setFrameShadow(QFrame::Sunken);
|
||||
return frame;
|
||||
}
|
||||
|
||||
LayoutBuilder::Break br;
|
||||
LayoutBuilder::Stretch st;
|
||||
LayoutBuilder::Space empty(0);
|
||||
|
||||
Reference in New Issue
Block a user