summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2016-11-18 14:10:35 +0100
committerLars Knoll <lars.knoll@qt.io>2016-11-29 19:04:48 +0000
commit7d12ef183ee6b7909c451a3042ecf8b1fc20f87f (patch)
treefdb717743892cbacb91340e1f9c30a02072a9705 /src/widgets/styles
parente3555fe9705a44072a05b95cca36579745e14125 (diff)
Clean up style selection code
Turn styles into proper features and test for them using qtConfig/QT_CONFIG. Change-Id: I7e28785a46723364b90d8aa286f4d6e5ab085651 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'src/widgets/styles')
-rw-r--r--src/widgets/styles/qandroidstyle.cpp4
-rw-r--r--src/widgets/styles/qandroidstyle_p.h4
-rw-r--r--src/widgets/styles/qfusionstyle.cpp4
-rw-r--r--src/widgets/styles/qfusionstyle_p.h4
-rw-r--r--src/widgets/styles/qfusionstyle_p_p.h4
-rw-r--r--src/widgets/styles/qmacstyle_mac_p.h2
-rw-r--r--src/widgets/styles/qstylefactory.cpp34
-rw-r--r--src/widgets/styles/qstyleoption.cpp5
-rw-r--r--src/widgets/styles/qwindowsstyle.cpp4
-rw-r--r--src/widgets/styles/qwindowsstyle_p.h4
-rw-r--r--src/widgets/styles/qwindowsstyle_p_p.h4
-rw-r--r--src/widgets/styles/qwindowsvistastyle.cpp2
-rw-r--r--src/widgets/styles/qwindowsvistastyle_p.h4
-rw-r--r--src/widgets/styles/qwindowsvistastyle_p_p.h4
-rw-r--r--src/widgets/styles/qwindowsxpstyle.cpp2
-rw-r--r--src/widgets/styles/qwindowsxpstyle_p.h4
-rw-r--r--src/widgets/styles/qwindowsxpstyle_p_p.h4
-rw-r--r--src/widgets/styles/styles.pri38
18 files changed, 58 insertions, 73 deletions
diff --git a/src/widgets/styles/qandroidstyle.cpp b/src/widgets/styles/qandroidstyle.cpp
index 743166549b..b37dffbe80 100644
--- a/src/widgets/styles/qandroidstyle.cpp
+++ b/src/widgets/styles/qandroidstyle.cpp
@@ -39,7 +39,7 @@
#include "qandroidstyle_p.h"
-#if !defined(QT_NO_STYLE_ANDROID) || defined(QT_PLUGIN)
+#if QT_CONFIG(style_android) || defined(QT_PLUGIN)
#include <QFile>
#include <QFont>
@@ -1807,4 +1807,4 @@ QRect QAndroidStyle::AndroidSpinnerControl::subControlRect(const QStyleOptionCom
QT_END_NAMESPACE
-#endif // !defined(QT_NO_STYLE_ANDROID) || defined(QT_PLUGIN)
+#endif // QT_CONFIG(style_android) || defined(QT_PLUGIN)
diff --git a/src/widgets/styles/qandroidstyle_p.h b/src/widgets/styles/qandroidstyle_p.h
index 4649d90852..caff0afada 100644
--- a/src/widgets/styles/qandroidstyle_p.h
+++ b/src/widgets/styles/qandroidstyle_p.h
@@ -60,7 +60,7 @@
QT_BEGIN_NAMESPACE
-#if !defined(QT_NO_STYLE_ANDROID)
+#if QT_CONFIG(style_android)
class Q_WIDGETS_EXPORT QAndroidStyle : public QFusionStyle
{
@@ -388,7 +388,7 @@ private:
AndroidCompoundButtonControl *checkBoxControl;
};
-#endif // QT_NO_STYLE_ANDROID
+#endif // style_android
QT_END_NAMESPACE
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 3473ec7fb0..74e4d53dca 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -40,7 +40,7 @@
#include "qfusionstyle_p.h"
#include "qfusionstyle_p_p.h"
-#if !defined(QT_NO_STYLE_FUSION) || defined(QT_PLUGIN)
+#if QT_CONFIG(style_fusion) || defined(QT_PLUGIN)
#include "qcommonstyle_p.h"
#include <qcombobox.h>
#include <qpushbutton.h>
@@ -3746,4 +3746,4 @@ QT_END_NAMESPACE
#include "moc_qfusionstyle_p.cpp"
-#endif // QT_NO_STYLE_FUSION || QT_PLUGIN
+#endif // style_fusion|| QT_PLUGIN
diff --git a/src/widgets/styles/qfusionstyle_p.h b/src/widgets/styles/qfusionstyle_p.h
index 126fb96e78..aac27e51ab 100644
--- a/src/widgets/styles/qfusionstyle_p.h
+++ b/src/widgets/styles/qfusionstyle_p.h
@@ -57,7 +57,7 @@
QT_BEGIN_NAMESPACE
-#if !defined(QT_NO_STYLE_FUSION)
+#if QT_CONFIG(style_fusion)
class QFusionStylePrivate;
class QFusionStyle : public QCommonStyle
@@ -110,7 +110,7 @@ protected:
};
-#endif // QT_NO_STYLE_FUSION
+#endif // style_fusion
QT_END_NAMESPACE
diff --git a/src/widgets/styles/qfusionstyle_p_p.h b/src/widgets/styles/qfusionstyle_p_p.h
index 8d1d27d244..169fd9a407 100644
--- a/src/widgets/styles/qfusionstyle_p_p.h
+++ b/src/widgets/styles/qfusionstyle_p_p.h
@@ -57,7 +57,7 @@
#include <qpa/qplatformtheme.h>
#include "private/qguiapplication_p.h"
-#ifndef QT_NO_STYLE_FUSION
+#if QT_CONFIG(style_fusion)
QT_BEGIN_NAMESPACE
@@ -147,6 +147,6 @@ public:
QT_END_NAMESPACE
-#endif // QT_NO_STYLE_FUSION
+#endif // style_fusion
#endif //QFUSIONSTYLE_P_P_H
diff --git a/src/widgets/styles/qmacstyle_mac_p.h b/src/widgets/styles/qmacstyle_mac_p.h
index 459784c538..3642424a14 100644
--- a/src/widgets/styles/qmacstyle_mac_p.h
+++ b/src/widgets/styles/qmacstyle_mac_p.h
@@ -57,7 +57,7 @@
QT_BEGIN_NAMESPACE
-#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if QT_CONFIG(style_mac)
class QPalette;
diff --git a/src/widgets/styles/qstylefactory.cpp b/src/widgets/styles/qstylefactory.cpp
index 09cccff4e8..8dc603f8e6 100644
--- a/src/widgets/styles/qstylefactory.cpp
+++ b/src/widgets/styles/qstylefactory.cpp
@@ -44,20 +44,20 @@
#include "qapplication.h"
#include "qwindowsstyle_p.h"
-#ifndef QT_NO_STYLE_FUSION
+#if QT_CONFIG(style_fusion)
#include "qfusionstyle_p.h"
-#ifndef QT_NO_STYLE_ANDROID
+#if QT_CONFIG(style_android)
#include "qandroidstyle_p.h"
#endif
#endif
-#ifndef QT_NO_STYLE_WINDOWSXP
+#if QT_CONFIG(style_windowsxp)
#include "qwindowsxpstyle_p.h"
#endif
-#ifndef QT_NO_STYLE_WINDOWSVISTA
+#if QT_CONFIG(style_windowsvista)
#include "qwindowsvistastyle_p.h"
#endif
-#if !defined(QT_NO_STYLE_MAC) && defined(Q_OS_MAC)
+#if QT_CONFIG(style_mac)
# include "qmacstyle_mac_p.h"
#endif
@@ -103,32 +103,32 @@ QStyle *QStyleFactory::create(const QString& key)
{
QStyle *ret = 0;
QString style = key.toLower();
-#ifndef QT_NO_STYLE_WINDOWS
+#if QT_CONFIG(style_windows)
if (style == QLatin1String("windows"))
ret = new QWindowsStyle;
else
#endif
-#ifndef QT_NO_STYLE_WINDOWSXP
+#if QT_CONFIG(style_windowsxp)
if (style == QLatin1String("windowsxp"))
ret = new QWindowsXPStyle;
else
#endif
-#ifndef QT_NO_STYLE_WINDOWSVISTA
+#if QT_CONFIG(style_windowsvista)
if (style == QLatin1String("windowsvista"))
ret = new QWindowsVistaStyle;
else
#endif
-#ifndef QT_NO_STYLE_FUSION
+#if QT_CONFIG(style_fusion)
if (style == QLatin1String("fusion"))
ret = new QFusionStyle;
else
#endif
-#ifndef QT_NO_STYLE_ANDROID
+#if QT_CONFIG(style_android)
if (style == QLatin1String("android"))
ret = new QAndroidStyle;
else
#endif
-#ifndef QT_NO_STYLE_MAC
+#if QT_CONFIG(style_mac)
if (style.startsWith(QLatin1String("macintosh"))) {
ret = new QMacStyle;
# if 0 // Used to be included in Qt4 for Q_WS_MAC
@@ -160,29 +160,29 @@ QStringList QStyleFactory::keys()
const PluginKeyMap::const_iterator cend = keyMap.constEnd();
for (PluginKeyMap::const_iterator it = keyMap.constBegin(); it != cend; ++it)
list.append(it.value());
-#ifndef QT_NO_STYLE_WINDOWS
+#if QT_CONFIG(style_windows)
if (!list.contains(QLatin1String("Windows")))
list << QLatin1String("Windows");
#endif
-#ifndef QT_NO_STYLE_WINDOWSXP
+#if QT_CONFIG(style_windowsxp)
if (!list.contains(QLatin1String("WindowsXP")) &&
(QSysInfo::WindowsVersion >= QSysInfo::WV_XP && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)))
list << QLatin1String("WindowsXP");
#endif
-#ifndef QT_NO_STYLE_WINDOWSVISTA
+#if QT_CONFIG(style_windowsvista)
if (!list.contains(QLatin1String("WindowsVista")) &&
(QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)))
list << QLatin1String("WindowsVista");
#endif
-#ifndef QT_NO_STYLE_ANDROID
+#if QT_CONFIG(style_android)
if (!list.contains(QLatin1String("Android")))
list << QLatin1String("Android");
#endif
-#ifndef QT_NO_STYLE_FUSION
+#if QT_CONFIG(style_fusion)
if (!list.contains(QLatin1String("Fusion")))
list << QLatin1String("Fusion");
#endif
-#ifndef QT_NO_STYLE_MAC
+#if QT_CONFIG(style_mac)
QString mstyle = QLatin1String("Macintosh");
# if 0 // Used to be included in Qt4 for Q_WS_MAC
mstyle += QLatin1String(" (aqua)");
diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp
index 83739655af..c12b3285f1 100644
--- a/src/widgets/styles/qstyleoption.cpp
+++ b/src/widgets/styles/qstyleoption.cpp
@@ -37,9 +37,10 @@
**
****************************************************************************/
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qstyleoption.h"
#include "qapplication.h"
-#ifdef Q_OS_MAC
+#if QT_CONFIG(style_mac)
# include "qmacstyle_mac_p.h"
#endif
#include <qdebug.h>
@@ -204,7 +205,7 @@ void QStyleOption::init(const QWidget *widget)
if (!(state & QStyle::State_Active) && !qt_mac_can_clickThrough(widget))
state &= ~QStyle::State_Enabled;
#endif
-#if defined(Q_OS_OSX) && !defined(QT_NO_STYLE_MAC)
+#if QT_CONFIG(style_mac)
switch (QMacStyle::widgetSizePolicy(widget)) {
case QMacStyle::SizeSmall:
state |= QStyle::State_Small;
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp
index e3bf28608c..a8ee881a30 100644
--- a/src/widgets/styles/qwindowsstyle.cpp
+++ b/src/widgets/styles/qwindowsstyle.cpp
@@ -40,7 +40,7 @@
#include "qwindowsstyle_p.h"
#include "qwindowsstyle_p_p.h"
-#if !defined(QT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN)
+#if QT_CONFIG(style_windows) || defined(QT_PLUGIN)
#include "qapplication.h"
#include "qbitmap.h"
@@ -2407,4 +2407,4 @@ QT_END_NAMESPACE
#include "moc_qwindowsstyle_p.cpp"
-#endif // QT_NO_STYLE_WINDOWS
+#endif // style_windows
diff --git a/src/widgets/styles/qwindowsstyle_p.h b/src/widgets/styles/qwindowsstyle_p.h
index 5d68bfeba0..a1d65610ff 100644
--- a/src/widgets/styles/qwindowsstyle_p.h
+++ b/src/widgets/styles/qwindowsstyle_p.h
@@ -57,7 +57,7 @@
QT_BEGIN_NAMESPACE
-#if !defined(QT_NO_STYLE_WINDOWS)
+#if QT_CONFIG(style_windows)
class QWindowsStylePrivate;
@@ -106,7 +106,7 @@ private:
Q_DECLARE_PRIVATE(QWindowsStyle)
};
-#endif // QT_NO_STYLE_WINDOWS
+#endif // style_windows
QT_END_NAMESPACE
diff --git a/src/widgets/styles/qwindowsstyle_p_p.h b/src/widgets/styles/qwindowsstyle_p_p.h
index 0c23f4b4a8..5023fd1042 100644
--- a/src/widgets/styles/qwindowsstyle_p_p.h
+++ b/src/widgets/styles/qwindowsstyle_p_p.h
@@ -55,7 +55,7 @@
#include "qwindowsstyle_p.h"
#include "qcommonstyle_p.h"
-#ifndef QT_NO_STYLE_WINDOWS
+#if QT_CONFIG(style_windows)
#include <qlist.h>
QT_BEGIN_NAMESPACE
@@ -103,7 +103,7 @@ private:
QT_END_NAMESPACE
-#endif // QT_NO_STYLE_WINDOWS
+#endif // style_windows
#endif //QWINDOWSSTYLE_P_P_H
;
diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp
index bf5aad0187..7759df9959 100644
--- a/src/widgets/styles/qwindowsvistastyle.cpp
+++ b/src/widgets/styles/qwindowsvistastyle.cpp
@@ -46,7 +46,7 @@
#include <private/qapplication_p.h>
#include <qpa/qplatformnativeinterface.h>
-#if !defined(QT_NO_STYLE_WINDOWSVISTA) || defined(QT_PLUGIN)
+#if QT_CONFIG(style_windowsvista) || defined(QT_PLUGIN)
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/styles/qwindowsvistastyle_p.h b/src/widgets/styles/qwindowsvistastyle_p.h
index 0289f404dd..8fbd1dc380 100644
--- a/src/widgets/styles/qwindowsvistastyle_p.h
+++ b/src/widgets/styles/qwindowsvistastyle_p.h
@@ -57,7 +57,7 @@
QT_BEGIN_NAMESPACE
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
class QWindowsVistaStylePrivate;
class QWindowsVistaStyle : public QWindowsXPStyle
@@ -103,7 +103,7 @@ private:
Q_DECLARE_PRIVATE(QWindowsVistaStyle)
friend class QStyleFactory;
};
-#endif //QT_NO_STYLE_WINDOWSVISTA
+#endif // style_windowsvista
QT_END_NAMESPACE
diff --git a/src/widgets/styles/qwindowsvistastyle_p_p.h b/src/widgets/styles/qwindowsvistastyle_p_p.h
index 4ca47fec2c..18b6f9c3f7 100644
--- a/src/widgets/styles/qwindowsvistastyle_p_p.h
+++ b/src/widgets/styles/qwindowsvistastyle_p_p.h
@@ -54,7 +54,7 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qwindowsvistastyle_p.h"
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
#include <private/qwindowsxpstyle_p_p.h>
#include <private/qstyleanimation_p.h>
#include <private/qpaintengine_raster_p.h>
@@ -177,6 +177,6 @@ public:
QT_END_NAMESPACE
-#endif // QT_NO_STYLE_WINDOWSVISTA
+#endif // style_windowsvista
#endif // QWINDOWSVISTASTYLE_P_P_H
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index 4ce359a7c4..f999d823e0 100644
--- a/src/widgets/styles/qwindowsxpstyle.cpp
+++ b/src/widgets/styles/qwindowsxpstyle.cpp
@@ -39,7 +39,7 @@
#include "qwindowsxpstyle_p.h"
#include "qwindowsxpstyle_p_p.h"
-#if !defined(QT_NO_STYLE_WINDOWSXP) || defined(QT_PLUGIN)
+#if QT_CONFIG(style_windowsxp) || defined(QT_PLUGIN)
#include <private/qobject_p.h>
#include <private/qpaintengine_raster_p.h>
diff --git a/src/widgets/styles/qwindowsxpstyle_p.h b/src/widgets/styles/qwindowsxpstyle_p.h
index 088178cb5a..62e3af927c 100644
--- a/src/widgets/styles/qwindowsxpstyle_p.h
+++ b/src/widgets/styles/qwindowsxpstyle_p.h
@@ -57,7 +57,7 @@
QT_BEGIN_NAMESPACE
-#if !defined(QT_NO_STYLE_WINDOWSXP)
+#if QT_CONFIG(style_windowsxp)
class QWindowsXPStylePrivate;
class QWindowsXPStyle : public QWindowsStyle
@@ -102,7 +102,7 @@ private:
friend class QStyleFactory;
};
-#endif // QT_NO_STYLE_WINDOWSXP
+#endif // style_windowsxp
QT_END_NAMESPACE
diff --git a/src/widgets/styles/qwindowsxpstyle_p_p.h b/src/widgets/styles/qwindowsxpstyle_p_p.h
index d6702c8803..fb5210cb07 100644
--- a/src/widgets/styles/qwindowsxpstyle_p_p.h
+++ b/src/widgets/styles/qwindowsxpstyle_p_p.h
@@ -94,7 +94,7 @@ QT_BEGIN_NAMESPACE
// Uncomment define below to build debug assisting code, and output
// #define DEBUG_XP_STYLE
-#if !defined(QT_NO_STYLE_WINDOWSXP)
+#if QT_CONFIG(style_windowsxp)
// Declarations -----------------------------------------------------------------------------------
class XPThemeData
@@ -338,7 +338,7 @@ inline QMarginsF XPThemeData::themeMargins(const QWidget *w, QPainter *p, int th
return theme.margins(propId);
}
-#endif // QT_NO_STYLE_WINDOWS
+#endif // style_windows
QT_END_NAMESPACE
diff --git a/src/widgets/styles/styles.pri b/src/widgets/styles/styles.pri
index 69e13fb6ec..481123f0d4 100644
--- a/src/widgets/styles/styles.pri
+++ b/src/widgets/styles/styles.pri
@@ -37,51 +37,35 @@ RESOURCES += styles/qstyle.qrc
include($$OUT_PWD/qtwidgets-config.pri)
-contains( styles, mac ) {
+qtConfig(style-mac) {
HEADERS += \
styles/qmacstyle_mac_p.h \
styles/qmacstyle_mac_p_p.h
OBJECTIVE_SOURCES += styles/qmacstyle_mac.mm
LIBS_PRIVATE += -framework Carbon
-} else {
- DEFINES += QT_NO_STYLE_MAC
}
-contains( styles, windowsvista ) {
- HEADERS += styles/qwindowsvistastyle_p.h
- HEADERS += styles/qwindowsvistastyle_p_p.h
+qtConfig(style-windowsvista) {
+ HEADERS += styles/qwindowsvistastyle_p.h styles/qwindowsvistastyle_p_p.h
SOURCES += styles/qwindowsvistastyle.cpp
-} else {
- DEFINES += QT_NO_STYLE_WINDOWSVISTA
}
-contains( styles, windowsxp ) {
- HEADERS += styles/qwindowsxpstyle_p.h
- HEADERS += styles/qwindowsxpstyle_p_p.h
+qtConfig(style-windowsxp) {
+ HEADERS += styles/qwindowsxpstyle_p.h styles/qwindowsxpstyle_p_p.h
SOURCES += styles/qwindowsxpstyle.cpp
-} else {
- DEFINES += QT_NO_STYLE_WINDOWSXP
}
-contains( styles, windows ) {
- HEADERS += styles/qwindowsstyle_p.h
- HEADERS += styles/qwindowsstyle_p_p.h
+qtConfig(style-windows) {
+ HEADERS += styles/qwindowsstyle_p.h styles/qwindowsstyle_p_p.h
SOURCES += styles/qwindowsstyle.cpp
-} else {
- DEFINES += QT_NO_STYLE_WINDOWS
}
-contains( styles, fusion ) {
- HEADERS += styles/qfusionstyle_p.h
- HEADERS += styles/qfusionstyle_p_p.h
- SOURCES += styles/qfusionstyle.cpp
-} else {
- DEFINES += QT_NO_STYLE_FUSION
+qtConfig(style-fusion) {
+ HEADERS += styles/qfusionstyle_p.h styles/qfusionstyle_p_p.h
+ SOURCES += styles/qfusionstyle.cpp
}
-contains( styles, android ) {
+qtConfig(style-android) {
HEADERS += styles/qandroidstyle_p.h
SOURCES += styles/qandroidstyle.cpp
-} else {
- DEFINES += QT_NO_STYLE_ANDROID
}