From 14dab5b2d7cb7b6b32d9672758c0f3b5d4ec3354 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 27 Nov 2012 00:06:14 +0100 Subject: Add QProxyStyle(QString key) constructor for convenience The QStyle implementations are becoming private, so the following slightly verbose pattern seems to be now repeated a lot: new QProxyStyle(QStyleFactory::create("windows")) This change adds an alternative, more convenient constructor for this particular use case: new QProxyStyle("windows") Change-Id: I97ded597a0fd3225a6354ebea0abb367237430af Reviewed-by: Jens Bache-Wiig --- tests/auto/widgets/styles/qstyle/tst_qstyle.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp index cf867194cc..a3670cccc2 100644 --- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp +++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp @@ -234,7 +234,10 @@ void tst_QStyle::testProxyStyle() QVERIFY(proxyStyle->baseStyle()); qApp->setStyle(proxyStyle); - QProxyStyle doubleProxy(new QProxyStyle(QStyleFactory::create("Windows"))); + QProxyStyle* baseStyle = new QProxyStyle("Windows"); + QCOMPARE(baseStyle->baseStyle()->objectName(), style->objectName()); + + QProxyStyle doubleProxy(baseStyle); QVERIFY(testAllFunctions(&doubleProxy)); CustomProxy customStyle; @@ -775,7 +778,7 @@ void tst_QStyle::testDrawingShortcuts() class FrameTestStyle : public QProxyStyle { public: - FrameTestStyle() : QProxyStyle(QStyleFactory::create("Windows")) { } + FrameTestStyle() : QProxyStyle("Windows") { } int styleHint(StyleHint hint, const QStyleOption *opt, const QWidget *widget, QStyleHintReturn *returnData) const { if (hint == QStyle::SH_ScrollView_FrameOnlyAroundContents) return 1; -- cgit v1.2.3