summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2020-09-22 10:43:32 +0200
committerAndy Shaw <andy.shaw@qt.io>2020-09-25 07:08:47 +0200
commit31a1b3280cf076fcdb45a658d0140af3737be138 (patch)
treef3336222c7f28b454c303bd5523e7e0498b7ba48
parent34b4dc11d9ee1eef5ac787848406e028d21f87df (diff)
Fusion: Don't add unnecessarily extra padding for a groupbox
If there is not a title or an indicator for a groupbox, then there is no reason to add extra padding for it when placing the contents of the groupbox. So this accounts for when one or the other is not set so that the space is used more evenly. Fixes: QTBUG-86411 Change-Id: I536798b57e1195c5a13218f1f82431c4e91f6852 Pick-to: 5.15 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
-rw-r--r--src/widgets/styles/qfusionstyle.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index daf0710b70..8e7005fafa 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -3437,7 +3437,12 @@ QRect QFusionStyle::subControlRect(ComplexControl control, const QStyleOptionCom
QRect frameRect = option->rect.adjusted(0, 0, 0, -groupBoxBottomMargin);
int margin = 3;
int leftMarginExtension = 0;
- int topMargin = qMax(pixelMetric(PM_ExclusiveIndicatorHeight), option->fontMetrics.height()) + groupBoxTopMargin;
+ const int exclusiveIndicatorHeight = option->subControls.testFlag(SC_GroupBoxCheckBox) ?
+ pixelMetric(PM_ExclusiveIndicatorHeight) : 0;
+ const int fontMetricsHeight = groupBox->text.isEmpty() ? 0 :
+ groupBox->fontMetrics.height();
+ const int topMargin = qMax(exclusiveIndicatorHeight, fontMetricsHeight) +
+ groupBoxTopMargin;
return frameRect.adjusted(leftMarginExtension + margin, margin + topMargin, -margin, -margin - groupBoxBottomMargin);
}