summaryrefslogtreecommitdiffstats
path: root/tests/auto/qstylesheetstyle
diff options
context:
space:
mode:
authorJens Bache-Wiig <jbache@trolltech.com>2010-01-08 11:03:48 (GMT)
committerJens Bache-Wiig <jbache@trolltech.com>2010-01-08 11:03:48 (GMT)
commitf90472009c928b3f599c182dfbab91390fdafdd9 (patch)
tree2b69a87c6b3461f745967c7f4b259606367453f4 /tests/auto/qstylesheetstyle
parent73629458a18ce577e0a46e61335ef92d18dac7be (diff)
downloadQt-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 'tests/auto/qstylesheetstyle')
-rw-r--r--tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
index 1b2f268..e0512a9 100644
--- a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -1114,7 +1114,10 @@ class ProxyStyle : public QStyle
const QStyleOption* opt,
const QWidget* w) const
{
- return style->subElementRect(se, opt, w);
+ Q_UNUSED(se);
+ Q_UNUSED(opt);
+ Q_UNUSED(w);
+ return QRect(0, 0, 3, 3);
}
void drawComplexControl(QStyle::ComplexControl cc,
@@ -1232,7 +1235,7 @@ void tst_QStyleSheetStyle::proxyStyle()
pb4->setStyleSheet(styleSheet);
// We are creating our Proxy based on current style...
- // In this case it would be the QStyleSheetStyle that is delete
+ // In this case it would be the QStyleSheetStyle that is deleted
// later on. We need to get access to the "real" QStyle to be able to
// draw correctly.
ProxyStyle* newProxy = new ProxyStyle(qApp->style());
@@ -1248,6 +1251,13 @@ void tst_QStyleSheetStyle::proxyStyle()
w->show();
QTest::qWait(100);
+
+ // Test for QTBUG-7198 - style sheet overrides custom element size
+ QStyleOptionViewItemV4 opt;
+ opt.initFrom(w);
+ opt.features |= QStyleOptionViewItemV2::HasCheckIndicator;
+ QVERIFY(pb5->style()->subElementRect(QStyle::SE_ItemViewItemCheckIndicator,
+ &opt, pb5).width() == 3);
delete w;
delete proxy;
delete newProxy;