summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGhenady Kuznetsov <scroller@rambler.ru>2024-01-01 19:25:20 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-01-17 16:56:50 +0000
commit6bdff3c8a0418cdb595437c115dd3f22ac71dbf3 (patch)
tree08b2f935716b52e9f2d62d45958b01a551c54da7
parent478deceb084802dc203e814bc66c59076591fa29 (diff)
Fusion style: add clip region for groupbox title
Fusion style is missing clip region for the title in QFusionStyle::drawComplexControl(). Without that region, the top line of the frame will be visible behind the vertically centered title. Fixes: QTBUG-121041 Change-Id: I3daf5854195e28a5ee3cb50343e2dd56e66ed940 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> (cherry picked from commit 9b4c35abff94a708139923a32c38a749cbdfd130) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 6affa9890d0acd51b0b4d63e4ac33323e392ee48)
-rw-r--r--src/widgets/styles/qfusionstyle.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 948e2e337b..9dcbd24c6e 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -1919,7 +1919,23 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
frame.lineWidth = groupBox->lineWidth;
frame.midLineWidth = groupBox->midLineWidth;
frame.rect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget);
+ painter->save();
+ QRegion region(groupBox->rect);
+ if (!groupBox->text.isEmpty()) {
+ bool ltr = groupBox->direction == Qt::LeftToRight;
+ QRect finalRect;
+ if (groupBox->subControls & QStyle::SC_GroupBoxCheckBox) {
+ finalRect = checkBoxRect.united(textRect);
+ finalRect.adjust(ltr ? -4 : -2, 0, ltr ? 2 : 4, 0);
+ } else {
+ finalRect = textRect;
+ finalRect.adjust(-2, 0, 2, 0);
+ }
+ region -= finalRect.adjusted(0, 0, 0, 3 - textRect.height() / 2);
+ }
+ painter->setClipRegion(region);
proxy()->drawPrimitive(PE_FrameGroupBox, &frame, painter, widget);
+ painter->restore();
}
// Draw title