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 Pick-to: 6.6 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>
This commit is contained in:
parent
5a44b8392d
commit
6affa9890d
@ -1837,7 +1837,23 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
|
|||||||
frame.lineWidth = groupBox->lineWidth;
|
frame.lineWidth = groupBox->lineWidth;
|
||||||
frame.midLineWidth = groupBox->midLineWidth;
|
frame.midLineWidth = groupBox->midLineWidth;
|
||||||
frame.rect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget);
|
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);
|
proxy()->drawPrimitive(PE_FrameGroupBox, &frame, painter, widget);
|
||||||
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw title
|
// Draw title
|
||||||
|
Loading…
x
Reference in New Issue
Block a user