diff options
author | Jens Bache-Wiig <jbache@trolltech.com> | 2010-01-08 11:03:48 (GMT) |
---|---|---|
committer | Jens Bache-Wiig <jbache@trolltech.com> | 2010-01-08 11:03:48 (GMT) |
commit | f90472009c928b3f599c182dfbab91390fdafdd9 (patch) | |
tree | 2b69a87c6b3461f745967c7f4b259606367453f4 /src/gui/styles | |
parent | 73629458a18ce577e0a46e61335ef92d18dac7be (diff) | |
download | Qt-f90472009c928b3f599c182dfbab91390fdafdd9.zip Qt-f90472009c928b3f599c182dfbab91390fdafdd9.tar.gz Qt-f90472009c928b3f599c182dfbab91390fdafdd9.tar.bz2 |
Fixes: Setting any style sheet breaks checkbox positioning
Task: QTBUG-7198
RevBy: ogoffart
Details:
It was impossible to override the checkbox positioning in a custom
style if any style sheet was set on the application of widget.
This was because the style sheet never passed control to the
base style. We now fix it by checking if the style sheet has
the appropriate style rules.
Diffstat (limited to 'src/gui/styles')
-rw-r--r-- | src/gui/styles/qstylesheetstyle.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index cf27eac..498313b 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -5611,9 +5611,6 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c case SE_ItemViewItemFocusRect: if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) { QRenderRule subRule = renderRule(w, opt, PseudoElement_ViewItem); - QStyleOptionViewItemV4 optCopy(*vopt); - optCopy.rect = subRule.contentsRect(vopt->rect); - QRect rect = ParentStyle::subElementRect(se, &optCopy, w); PseudoElement pe = PseudoElement_None; if (se == SE_ItemViewItemText || se == SE_ItemViewItemFocusRect) pe = PseudoElement_ViewItemText; @@ -5623,8 +5620,13 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c pe = PseudoElement_ViewItemIndicator; else break; - QRenderRule subRule2 = renderRule(w, opt, pe); - return positionRect(w, subRule2, pe, rect, opt->direction); + if (subRule.hasGeometry() || subRule.hasBox() || !subRule.hasNativeBorder() || hasStyleRule(w, pe)) { + QRenderRule subRule2 = renderRule(w, opt, pe); + QStyleOptionViewItemV4 optCopy(*vopt); + optCopy.rect = subRule.contentsRect(vopt->rect); + QRect rect = ParentStyle::subElementRect(se, &optCopy, w); + return positionRect(w, subRule2, pe, rect, opt->direction); + } } break; #endif // QT_NO_ITEMVIEWS |