From e7f18d9d144f4a557e1d0851bd29c4e441a124c8 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 15 Jul 2022 15:59:04 +0200 Subject: [PATCH] Utils: Do not use fixed values for margins in LayoutBuilder Change-Id: I4af69c149fc1e71134ac6dd5de9a9428c9d3d73d Reviewed-by: Eike Ziller --- src/libs/utils/layoutbuilder.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/utils/layoutbuilder.cpp b/src/libs/utils/layoutbuilder.cpp index ecd54e16bc2..a1444656824 100644 --- a/src/libs/utils/layoutbuilder.cpp +++ b/src/libs/utils/layoutbuilder.cpp @@ -140,8 +140,8 @@ QLayout *LayoutBuilder::createLayout() const static void setMargins(bool on, QLayout *layout) { - const int d = on ? 9 : 0; - layout->setContentsMargins(d, d, d, d); + if (!on) + layout->setContentsMargins(0, 0, 0, 0); } 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 (pendingFormItems.size() > 2) { auto hbox = new QHBoxLayout; - setMargins(false, hbox); + hbox->setContentsMargins(0, 0, 0, 0); for (int i = 1; i < pendingFormItems.size(); ++i) addItemToBoxLayout(hbox, pendingFormItems.at(i)); while (pendingFormItems.size() >= 2)