build fix for the case when QT_NO_STYLE_PROXY is defined

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-02-26 20:59:08 +02:00
parent f932710e16
commit e6c7cf9300
2 changed files with 14 additions and 2 deletions

View file

@ -141,6 +141,7 @@
// #cmakedefine QT_NO_STACKEDWIDGET // #cmakedefine QT_NO_STACKEDWIDGET
// #cmakedefine QT_NO_STANDARDITEMMODEL // #cmakedefine QT_NO_STANDARDITEMMODEL
// #cmakedefine QT_NO_STATUSBAR // #cmakedefine QT_NO_STATUSBAR
// #cmakedefine QT_NO_STATUSTIP
// Misc // Misc
#cmakedefine QT_NO_USING_NAMESPACE #cmakedefine QT_NO_USING_NAMESPACE
@ -184,7 +185,6 @@
#cmakedefine QT_NO_SHAREDMEMORY #cmakedefine QT_NO_SHAREDMEMORY
#cmakedefine QT_NO_SIZEGRIP #cmakedefine QT_NO_SIZEGRIP
#cmakedefine QT_NO_SPLASHSCREEN #cmakedefine QT_NO_SPLASHSCREEN
#cmakedefine QT_NO_STATUSTIP
#cmakedefine QT_NO_STRINGLISTMODEL #cmakedefine QT_NO_STRINGLISTMODEL
#cmakedefine QT_NO_STYLE_CLEANLOOKS #cmakedefine QT_NO_STYLE_CLEANLOOKS
#cmakedefine QT_NO_STYLE_PROXY #cmakedefine QT_NO_STYLE_PROXY

View file

@ -144,6 +144,7 @@ void tst_QStyle::testStyleFactory()
} }
} }
#ifndef QT_NO_STYLE_PROXY
class CustomProxy : public QProxyStyle class CustomProxy : public QProxyStyle
{ {
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, virtual int pixelMetric(PixelMetric metric, const QStyleOption *option = 0,
@ -154,9 +155,11 @@ class CustomProxy : public QProxyStyle
return QProxyStyle::pixelMetric(metric, option, widget); return QProxyStyle::pixelMetric(metric, option, widget);
} }
}; };
#endif // QT_NO_STYLE_PROXY
void tst_QStyle::testProxyStyle() void tst_QStyle::testProxyStyle()
{ {
#ifndef QT_NO_STYLE_PROXY
QProxyStyle *proxyStyle = new QProxyStyle(); QProxyStyle *proxyStyle = new QProxyStyle();
QVERIFY(proxyStyle->baseStyle()); QVERIFY(proxyStyle->baseStyle());
QStyle *style = new QWindowsStyle; QStyle *style = new QWindowsStyle;
@ -180,6 +183,9 @@ void tst_QStyle::testProxyStyle()
edit.setStyle(&customStyle); edit.setStyle(&customStyle);
QVERIFY(!customStyle.parent()); QVERIFY(!customStyle.parent());
QVERIFY(edit.style()->pixelMetric(QStyle::PM_ButtonIconSize) == 13); QVERIFY(edit.style()->pixelMetric(QStyle::PM_ButtonIconSize) == 13);
#else // QT_NO_STYLE_PROXY
QSKIP("Katie compiled without style proxy support (QT_NO_STYLE_PROXY)", SkipAll);
#endif // QT_NO_STYLE_PROXY
} }
void tst_QStyle::drawItemPixmap() void tst_QStyle::drawItemPixmap()
@ -466,6 +472,7 @@ void tst_QStyle::defaultFont()
qApp->setFont(defaultFont); qApp->setFont(defaultFont);
} }
#ifndef QT_NO_STYLE_PROXY
class DrawTextStyle : public QProxyStyle class DrawTextStyle : public QProxyStyle
{ {
Q_OBJECT Q_OBJECT
@ -481,9 +488,11 @@ public:
} }
int alignment; int alignment;
}; };
#endif // QT_NO_STYLE_PROXY
void tst_QStyle::testDrawingShortcuts() void tst_QStyle::testDrawingShortcuts()
{ {
#ifndef QT_NO_STYLE_PROXY
{ {
QWidget w; QWidget w;
setFrameless(&w); setFrameless(&w);
@ -515,6 +524,9 @@ void tst_QStyle::testDrawingShortcuts()
QVERIFY(dts->alignment & (showMnemonic ? Qt::TextShowMnemonic : Qt::TextHideMnemonic)); QVERIFY(dts->alignment & (showMnemonic ? Qt::TextShowMnemonic : Qt::TextHideMnemonic));
delete dts; delete dts;
} }
#else // QT_NO_STYLE_PROXY
QSKIP("Katie compiled without style proxy support (QT_NO_STYLE_PROXY)", SkipAll);
#endif // QT_NO_STYLE_PROXY
} }
QTEST_MAIN(tst_QStyle) QTEST_MAIN(tst_QStyle)