From 0303852c23c10e9538d9ee7cca41bedd9c022ec9 Mon Sep 17 00:00:00 2001 From: Ghenady Kuznetsov Date: Mon, 1 Jan 2024 18:47:18 +0200 Subject: [PATCH] Fusion style: wrongly used PixelMetric enum Wrongly used QStyle::PM_ExclusiveIndicatorHeight, which is height of a radio button indicator instead of QStyle::PM_IndicatorHeight, which is height of a checkbox indicator in pixelMetric() calls for checkbox subcontrol of groupbox. Pick-to: 6.6 Change-Id: Ifbf7783fd4494d1e00ee28c27fa5f62b319b8787 Reviewed-by: Christian Ehrlicher (cherry picked from commit b820aa7a04be0308b00c32b0e884421fbbb89269) Reviewed-by: Qt Cherry-pick Bot --- src/widgets/styles/qfusionstyle.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 3535685a2dd..fe13b867444 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -352,7 +352,7 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem, // Shrinking the topMargin if Not checkable AND title is empty topMargin = groupBoxTopMargin; } else { - topMargin = qMax(pixelMetric(PM_ExclusiveIndicatorHeight, option, widget), option->fontMetrics.height()) + groupBoxTopMargin; + topMargin = qMax(pixelMetric(PM_IndicatorHeight, option, widget), option->fontMetrics.height()) + groupBoxTopMargin; } QRect frame = option->rect.adjusted(0, topMargin, 0, 0); qDrawBorderPixmap(painter, frame, QMargins(6, 6, 6, 6), pixmap); @@ -3048,7 +3048,7 @@ QSize QFusionStyle::sizeFromContents(ContentsType type, const QStyleOption *opti break; case CT_GroupBox: if (option) { - int topMargin = qMax(pixelMetric(PM_ExclusiveIndicatorHeight, option, widget), option->fontMetrics.height()) + groupBoxTopMargin; + int topMargin = qMax(pixelMetric(PM_IndicatorHeight, option, widget), option->fontMetrics.height()) + groupBoxTopMargin; newSize += QSize(10, topMargin); // Add some space below the groupbox } break; @@ -3340,9 +3340,9 @@ QRect QFusionStyle::subControlRect(ComplexControl control, const QStyleOptionCom QRect frameRect = option->rect.adjusted(0, 0, 0, -groupBoxBottomMargin); int margin = 3; int leftMarginExtension = 0; - const int exclusiveIndicatorHeight = option->subControls.testFlag(SC_GroupBoxCheckBox) ? - pixelMetric(PM_ExclusiveIndicatorHeight, option, widget) : 0; - const int topMargin = qMax(exclusiveIndicatorHeight, fontMetricsHeight) + + const int indicatorHeight = option->subControls.testFlag(SC_GroupBoxCheckBox) ? + pixelMetric(PM_IndicatorHeight, option, widget) : 0; + const int topMargin = qMax(indicatorHeight, fontMetricsHeight) + groupBoxTopMargin; return frameRect.adjusted(leftMarginExtension + margin, margin + topMargin, -margin, -margin - groupBoxBottomMargin); }