forked from qt-creator/qt-creator
Utils: Do not use fixed values for margins in LayoutBuilder
Change-Id: I4af69c149fc1e71134ac6dd5de9a9428c9d3d73d Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -140,8 +140,8 @@ QLayout *LayoutBuilder::createLayout() const
|
|||||||
|
|
||||||
static void setMargins(bool on, QLayout *layout)
|
static void setMargins(bool on, QLayout *layout)
|
||||||
{
|
{
|
||||||
const int d = on ? 9 : 0;
|
if (!on)
|
||||||
layout->setContentsMargins(d, d, d, d);
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static QWidget *widgetForItem(QLayoutItem *item)
|
static QWidget *widgetForItem(QLayoutItem *item)
|
||||||
@@ -188,7 +188,7 @@ static void flushPendingFormItems(QFormLayout *formLayout,
|
|||||||
// If there are more than two items, we cram the last ones in one hbox.
|
// If there are more than two items, we cram the last ones in one hbox.
|
||||||
if (pendingFormItems.size() > 2) {
|
if (pendingFormItems.size() > 2) {
|
||||||
auto hbox = new QHBoxLayout;
|
auto hbox = new QHBoxLayout;
|
||||||
setMargins(false, hbox);
|
hbox->setContentsMargins(0, 0, 0, 0);
|
||||||
for (int i = 1; i < pendingFormItems.size(); ++i)
|
for (int i = 1; i < pendingFormItems.size(); ++i)
|
||||||
addItemToBoxLayout(hbox, pendingFormItems.at(i));
|
addItemToBoxLayout(hbox, pendingFormItems.at(i));
|
||||||
while (pendingFormItems.size() >= 2)
|
while (pendingFormItems.size() >= 2)
|
||||||
|
Reference in New Issue
Block a user