diff options
author | Jake Petroules <jake.petroules@qt.io> | 2017-02-27 18:39:44 -0800 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2017-04-14 17:07:54 +0000 |
commit | 4f3249f32dbe5c20aabbfd9b4f9c558aaf449e48 (patch) | |
tree | 42fabff161ec455e2e5eeb0e4182c86f0abc82bb /src | |
parent | 571eb37ac95a5cf9d566e8c6c965838ee274f950 (diff) |
Pluginize the platform styles
This enforces decoupling and in the case of QMacStyle, isolates
QtWidgets and therefore end user applications, from Carbon/HITheme.
Windows and Fusion are platform independent, so they remain built-in
(but mostly because the Windows style is tightly coupled to other styles
like QStylesheetStyle).
Task-number: QTBUG-59428
Change-Id: Id6519fe0c5269c1bce5b5921f9db06257032a1c9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Diffstat (limited to 'src')
36 files changed, 296 insertions, 134 deletions
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 620d9cb8c9..710a6c94c1 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -8,6 +8,7 @@ qtHaveModule(gui) { qtConfig(imageformatplugin): SUBDIRS *= imageformats !android:qtConfig(library): SUBDIRS *= generic } +qtHaveModule(widgets): SUBDIRS += styles !winrt:!wince:qtHaveModule(printsupport): \ SUBDIRS += printsupport diff --git a/src/plugins/styles/android/android.pro b/src/plugins/styles/android/android.pro new file mode 100644 index 0000000000..4ca35d8046 --- /dev/null +++ b/src/plugins/styles/android/android.pro @@ -0,0 +1,16 @@ +TARGET = qandroidstyle + +QT += widgets-private + +SOURCES += \ + main.cpp \ + qandroidstyle.cpp + +HEADERS += \ + qandroidstyle_p.h + +DISTFILES += androidstyle.json + +PLUGIN_TYPE = styles +PLUGIN_CLASS_NAME = QAndroidStylePlugin +load(qt_plugin) diff --git a/src/plugins/styles/android/androidstyle.json b/src/plugins/styles/android/androidstyle.json new file mode 100644 index 0000000000..6843bd3301 --- /dev/null +++ b/src/plugins/styles/android/androidstyle.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "android" ] +} diff --git a/src/plugins/styles/android/main.cpp b/src/plugins/styles/android/main.cpp new file mode 100644 index 0000000000..2121538b0a --- /dev/null +++ b/src/plugins/styles/android/main.cpp @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtWidgets/qstyleplugin.h> +#include "qandroidstyle_p.h" + +QT_BEGIN_NAMESPACE + +class QAndroidStylePlugin : public QStylePlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QStyleFactoryInterface" FILE "androidstyle.json") +public: + QStyle *create(const QString &key); +}; + +QStyle *QAndroidStylePlugin::create(const QString &key) +{ + if (key.compare(QLatin1String("android"), Qt::CaseInsensitive) == 0) + return new QAndroidStyle(); + + return 0; +} + +QT_END_NAMESPACE + +#include "main.moc" + diff --git a/src/widgets/styles/qandroidstyle.cpp b/src/plugins/styles/android/qandroidstyle.cpp index 110153d0f6..ed8c342668 100644 --- a/src/widgets/styles/qandroidstyle.cpp +++ b/src/plugins/styles/android/qandroidstyle.cpp @@ -39,8 +39,6 @@ #include "qandroidstyle_p.h" -#if QT_CONFIG(style_android) || defined(QT_PLUGIN) - #include <QFile> #include <QFont> #include <QApplication> @@ -1805,5 +1803,3 @@ QRect QAndroidStyle::AndroidSpinnerControl::subControlRect(const QStyleOptionCom } QT_END_NAMESPACE - -#endif // QT_CONFIG(style_android) || defined(QT_PLUGIN) diff --git a/src/widgets/styles/qandroidstyle_p.h b/src/plugins/styles/android/qandroidstyle_p.h index caff0afada..3faa08afb9 100644 --- a/src/widgets/styles/qandroidstyle_p.h +++ b/src/plugins/styles/android/qandroidstyle_p.h @@ -52,16 +52,14 @@ // #include <QtWidgets/private/qtwidgetsglobal_p.h> +#include <QtWidgets/private/qfusionstyle_p.h> #include <QtCore/QList> #include <QtCore/QMargins> #include <QtCore/QHash> #include <QtCore/QVariantMap> -#include "qfusionstyle_p.h" QT_BEGIN_NAMESPACE -#if QT_CONFIG(style_android) - class Q_WIDGETS_EXPORT QAndroidStyle : public QFusionStyle { Q_OBJECT @@ -388,8 +386,6 @@ private: AndroidCompoundButtonControl *checkBoxControl; }; -#endif // style_android - QT_END_NAMESPACE #endif // QANDROIDSTYLE_P_H diff --git a/src/plugins/styles/mac/mac.pro b/src/plugins/styles/mac/mac.pro new file mode 100644 index 0000000000..bf9660eed3 --- /dev/null +++ b/src/plugins/styles/mac/mac.pro @@ -0,0 +1,19 @@ +TARGET = qmacstyle + +QT += widgets-private + +SOURCES += \ + main.mm \ + qmacstyle_mac.mm + +HEADERS += \ + qmacstyle_mac_p.h \ + qmacstyle_mac_p_p.h + +LIBS_PRIVATE += -framework AppKit -framework Carbon + +DISTFILES += macstyle.json + +PLUGIN_TYPE = styles +PLUGIN_CLASS_NAME = QMacStylePlugin +load(qt_plugin) diff --git a/src/plugins/styles/mac/macstyle.json b/src/plugins/styles/mac/macstyle.json new file mode 100644 index 0000000000..5897815eec --- /dev/null +++ b/src/plugins/styles/mac/macstyle.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "macintosh" ] +} diff --git a/src/plugins/styles/mac/main.mm b/src/plugins/styles/mac/main.mm new file mode 100644 index 0000000000..ae31bb95fb --- /dev/null +++ b/src/plugins/styles/mac/main.mm @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtWidgets/qstyleplugin.h> +#include "qmacstyle_mac_p.h" + +QT_BEGIN_NAMESPACE + +class QMacStylePlugin : public QStylePlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QStyleFactoryInterface" FILE "macstyle.json") +public: + QStyle *create(const QString &key); +}; + +QStyle *QMacStylePlugin::create(const QString &key) +{ + QMacAutoReleasePool pool; + if (key.compare(QLatin1String("macintosh"), Qt::CaseInsensitive) == 0) + return new QMacStyle(); + + return 0; +} + +QT_END_NAMESPACE + +#include "main.moc" + diff --git a/src/widgets/styles/qmacstyle.qdoc b/src/plugins/styles/mac/qmacstyle.qdoc index fcbc813844..fcbc813844 100644 --- a/src/widgets/styles/qmacstyle.qdoc +++ b/src/plugins/styles/mac/qmacstyle.qdoc diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 47193f2a84..47193f2a84 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm diff --git a/src/widgets/styles/qmacstyle_mac_p.h b/src/plugins/styles/mac/qmacstyle_mac_p.h index 03f5d7280f..6011baeea2 100644 --- a/src/widgets/styles/qmacstyle_mac_p.h +++ b/src/plugins/styles/mac/qmacstyle_mac_p.h @@ -56,9 +56,6 @@ QT_BEGIN_NAMESPACE - -#if QT_CONFIG(style_mac) - class QPalette; class QPushButton; @@ -126,8 +123,6 @@ private: #endif }; -#endif - QT_END_NAMESPACE #endif // QMACSTYLE_MAC_P_H diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/plugins/styles/mac/qmacstyle_mac_p_p.h index 9bbd0995a5..6fd6d0c900 100644 --- a/src/widgets/styles/qmacstyle_mac_p_p.h +++ b/src/plugins/styles/mac/qmacstyle_mac_p_p.h @@ -45,8 +45,8 @@ #undef check #include <QtWidgets/private/qtwidgetsglobal_p.h> +#include <QtWidgets/private/qcommonstyle_p.h> #include "qmacstyle_mac_p.h" -#include "qcommonstyle_p.h" #include <private/qapplication_p.h> #include <private/qcombobox_p.h> #include <private/qpainter_p.h> diff --git a/src/plugins/styles/styles.pro b/src/plugins/styles/styles.pro new file mode 100644 index 0000000000..542ad1329a --- /dev/null +++ b/src/plugins/styles/styles.pro @@ -0,0 +1,8 @@ +TEMPLATE = subdirs +QT_FOR_CONFIG += widgets-private + +qtConfig(style-android): SUBDIRS += android + +qtConfig(style-mac): SUBDIRS += mac + +qtConfig(style-windowsvista): SUBDIRS += windowsvista diff --git a/src/plugins/styles/windowsvista/main.cpp b/src/plugins/styles/windowsvista/main.cpp new file mode 100644 index 0000000000..d5048e45b7 --- /dev/null +++ b/src/plugins/styles/windowsvista/main.cpp @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtWidgets/private/qtwidgetsglobal_p.h> +#include <QtWidgets/qstyleplugin.h> +#include "qwindowsvistastyle_p.h" + +QT_BEGIN_NAMESPACE + +class QWindowsVistaStylePlugin : public QStylePlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QStyleFactoryInterface" FILE "windowsvistastyle.json") +public: + QStyle *create(const QString &key); +}; + +QStyle *QWindowsVistaStylePlugin::create(const QString &key) +{ + if (key.compare(QLatin1String("windowsvista"), Qt::CaseInsensitive) == 0) + return new QWindowsVistaStyle(); + + return 0; +} + +QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp index 5a53627e95..1a1094a934 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp @@ -47,8 +47,6 @@ #include <private/qapplication_p.h> #include <qpa/qplatformnativeinterface.h> -#if QT_CONFIG(style_windowsvista) || defined(QT_PLUGIN) - QT_BEGIN_NAMESPACE static const int windowsItemFrame = 2; // menu item frame width @@ -2487,5 +2485,3 @@ QIcon QWindowsVistaStyle::standardIcon(StandardPixmap standardIcon, } QT_END_NAMESPACE - -#endif //QT_NO_WINDOWSVISTA diff --git a/src/widgets/styles/qwindowsvistastyle_p.h b/src/plugins/styles/windowsvista/qwindowsvistastyle_p.h index 8fbd1dc380..5ffcbc6aa9 100644 --- a/src/widgets/styles/qwindowsvistastyle_p.h +++ b/src/plugins/styles/windowsvista/qwindowsvistastyle_p.h @@ -52,13 +52,10 @@ // #include <QtWidgets/private/qtwidgetsglobal_p.h> -#include <private/qwindowsxpstyle_p.h> +#include "qwindowsxpstyle_p.h" QT_BEGIN_NAMESPACE - -#if QT_CONFIG(style_windowsvista) - class QWindowsVistaStylePrivate; class QWindowsVistaStyle : public QWindowsXPStyle { @@ -103,7 +100,6 @@ private: Q_DECLARE_PRIVATE(QWindowsVistaStyle) friend class QStyleFactory; }; -#endif // style_windowsvista QT_END_NAMESPACE diff --git a/src/widgets/styles/qwindowsvistastyle_p_p.h b/src/plugins/styles/windowsvista/qwindowsvistastyle_p_p.h index db358e6f6c..ee3a12c641 100644 --- a/src/widgets/styles/qwindowsvistastyle_p_p.h +++ b/src/plugins/styles/windowsvista/qwindowsvistastyle_p_p.h @@ -53,9 +53,7 @@ #include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qwindowsvistastyle_p.h" - -#if QT_CONFIG(style_windowsvista) -#include <private/qwindowsxpstyle_p_p.h> +#include "qwindowsxpstyle_p_p.h" #include <private/qstyleanimation_p.h> #include <private/qpaintengine_raster_p.h> #include <qpaintengine.h> @@ -179,6 +177,4 @@ public: QT_END_NAMESPACE -#endif // style_windowsvista - #endif // QWINDOWSVISTASTYLE_P_P_H diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp index 2fd40a57af..3f59886f1d 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp @@ -39,8 +39,6 @@ #include "qwindowsxpstyle_p.h" #include "qwindowsxpstyle_p_p.h" -#if QT_CONFIG(style_windowsvista) || defined(QT_PLUGIN) - #include <private/qobject_p.h> #include <private/qpaintengine_raster_p.h> #include <private/qapplication_p.h> @@ -4223,5 +4221,3 @@ void QWindowsXPStylePrivate::showProperties(XPThemeData &themeData) QT_END_NAMESPACE - -#endif //QT_NO_WINDOWSXP diff --git a/src/widgets/styles/qwindowsxpstyle_p.h b/src/plugins/styles/windowsvista/qwindowsxpstyle_p.h index 83c96abb7d..d00620eefa 100644 --- a/src/widgets/styles/qwindowsxpstyle_p.h +++ b/src/plugins/styles/windowsvista/qwindowsxpstyle_p.h @@ -52,13 +52,10 @@ // #include <QtWidgets/private/qtwidgetsglobal_p.h> -#include <private/qwindowsstyle_p.h> +#include <QtWidgets/private/qwindowsstyle_p.h> QT_BEGIN_NAMESPACE - -#if QT_CONFIG(style_windowsvista) - class QWindowsXPStylePrivate; class QWindowsXPStyle : public QWindowsStyle { @@ -102,8 +99,6 @@ private: friend class QStyleFactory; }; -#endif // style_windowsvista - QT_END_NAMESPACE #endif // QWINDOWSXPSTYLE_P_H diff --git a/src/widgets/styles/qwindowsxpstyle_p_p.h b/src/plugins/styles/windowsvista/qwindowsxpstyle_p_p.h index 8cac01950c..721a734829 100644 --- a/src/widgets/styles/qwindowsxpstyle_p_p.h +++ b/src/plugins/styles/windowsvista/qwindowsxpstyle_p_p.h @@ -53,7 +53,7 @@ #include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qwindowsxpstyle_p.h" -#include "qwindowsstyle_p_p.h" +#include <QtWidgets/private/qwindowsstyle_p_p.h> #include <qmap.h> #include <qt_windows.h> @@ -94,8 +94,6 @@ QT_BEGIN_NAMESPACE // Uncomment define below to build debug assisting code, and output // #define DEBUG_XP_STYLE -#if QT_CONFIG(style_windowsvista) - // Declarations ----------------------------------------------------------------------------------- class XPThemeData { @@ -338,8 +336,6 @@ inline QMarginsF XPThemeData::themeMargins(const QWidget *w, QPainter *p, int th return theme.margins(propId); } -#endif // style_windows - QT_END_NAMESPACE #endif //QWINDOWSXPSTYLE_P_P_H diff --git a/src/plugins/styles/windowsvista/windowsvista.pro b/src/plugins/styles/windowsvista/windowsvista.pro new file mode 100644 index 0000000000..f82bcfc91b --- /dev/null +++ b/src/plugins/styles/windowsvista/windowsvista.pro @@ -0,0 +1,22 @@ +TARGET = qwindowsvistastyle + +QT += widgets-private + +SOURCES += main.cpp + +HEADERS += qwindowsvistastyle_p.h qwindowsvistastyle_p_p.h +SOURCES += qwindowsvistastyle.cpp + +HEADERS += qwindowsxpstyle_p.h qwindowsxpstyle_p_p.h +SOURCES += qwindowsxpstyle.cpp + +LIBS_PRIVATE += -lgdi32 -luser32 + +# DEFINES/LIBS needed for qwizard_win.cpp and the styles +include(../../../widgets/kernel/win.pri) + +DISTFILES += windowsvistastyle.json + +PLUGIN_TYPE = styles +PLUGIN_CLASS_NAME = QWindowsVistaStylePlugin +load(qt_plugin) diff --git a/src/plugins/styles/windowsvista/windowsvistastyle.json b/src/plugins/styles/windowsvista/windowsvistastyle.json new file mode 100644 index 0000000000..771aa0c600 --- /dev/null +++ b/src/plugins/styles/windowsvista/windowsvistastyle.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "windowsvista" ] +} diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 1716d36ac5..d7282d8c26 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -2726,7 +2726,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event, case enter/leave events are genereated by the underlying windowing system. */ extern QPointer<QWidget> qt_last_mouse_receiver; -extern QWidget *qt_button_down; +extern Q_WIDGETS_EXPORT QWidget *qt_button_down; void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget) { #ifndef QT_NO_CURSOR @@ -3751,7 +3751,6 @@ static void grabForPopup(QWidget *popup) } } -extern QWidget *qt_button_down; extern QWidget *qt_popup_down; extern bool qt_replay_popup_mouse_event; diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index 271844a23e..f20d10fe6f 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -92,7 +92,7 @@ extern QClipboard *qt_clipboard; #endif typedef QHash<QByteArray, QFont> FontHash; -FontHash *qt_app_fonts_hash(); +Q_WIDGETS_EXPORT FontHash *qt_app_fonts_hash(); typedef QHash<QByteArray, QPalette> PaletteHash; PaletteHash *qt_app_palettes_hash(); diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 44fd4b6a80..5b695d9f30 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE Q_WIDGETS_EXPORT extern bool qt_tab_all_widgets(); -QWidget *qt_button_down = 0; // widget got last button-down +Q_WIDGETS_EXPORT QWidget *qt_button_down = 0; // widget got last button-down // popup control QWidget *qt_popup_down = 0; // popup that contains the pressed widget diff --git a/src/widgets/styles/qcommonstyle_p.h b/src/widgets/styles/qcommonstyle_p.h index 2ef7f30d21..ebfc06139c 100644 --- a/src/widgets/styles/qcommonstyle_p.h +++ b/src/widgets/styles/qcommonstyle_p.h @@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE class QStringList; // Private class -class QCommonStylePrivate : public QStylePrivate +class Q_WIDGETS_EXPORT QCommonStylePrivate : public QStylePrivate { Q_DECLARE_PUBLIC(QCommonStyle) public: diff --git a/src/widgets/styles/qfusionstyle_p.h b/src/widgets/styles/qfusionstyle_p.h index aac27e51ab..10f76045d5 100644 --- a/src/widgets/styles/qfusionstyle_p.h +++ b/src/widgets/styles/qfusionstyle_p.h @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE #if QT_CONFIG(style_fusion) class QFusionStylePrivate; -class QFusionStyle : public QCommonStyle +class Q_WIDGETS_EXPORT QFusionStyle : public QCommonStyle { Q_OBJECT Q_DECLARE_PRIVATE(QFusionStyle) diff --git a/src/widgets/styles/qstyleanimation_p.h b/src/widgets/styles/qstyleanimation_p.h index 3b10eeea27..e5cfe0bbee 100644 --- a/src/widgets/styles/qstyleanimation_p.h +++ b/src/widgets/styles/qstyleanimation_p.h @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE // We mean it. // -class QStyleAnimation : public QAbstractAnimation +class Q_WIDGETS_EXPORT QStyleAnimation : public QAbstractAnimation { Q_OBJECT @@ -106,7 +106,7 @@ private: int _skip; }; -class QProgressStyleAnimation : public QStyleAnimation +class Q_WIDGETS_EXPORT QProgressStyleAnimation : public QStyleAnimation { Q_OBJECT @@ -127,7 +127,7 @@ private: mutable int _step; }; -class QNumberStyleAnimation : public QStyleAnimation +class Q_WIDGETS_EXPORT QNumberStyleAnimation : public QStyleAnimation { Q_OBJECT @@ -151,7 +151,7 @@ private: mutable qreal _prev; }; -class QBlendStyleAnimation : public QStyleAnimation +class Q_WIDGETS_EXPORT QBlendStyleAnimation : public QStyleAnimation { Q_OBJECT @@ -178,7 +178,7 @@ private: QImage _current; }; -class QScrollbarStyleAnimation : public QNumberStyleAnimation +class Q_WIDGETS_EXPORT QScrollbarStyleAnimation : public QNumberStyleAnimation { Q_OBJECT diff --git a/src/widgets/styles/qstylefactory.cpp b/src/widgets/styles/qstylefactory.cpp index e29794aeb1..c959994d2c 100644 --- a/src/widgets/styles/qstylefactory.cpp +++ b/src/widgets/styles/qstylefactory.cpp @@ -46,16 +46,6 @@ #include "qwindowsstyle_p.h" #if QT_CONFIG(style_fusion) #include "qfusionstyle_p.h" -#if QT_CONFIG(style_android) -#include "qandroidstyle_p.h" -#endif -#endif -#if QT_CONFIG(style_windowsvista) -#include "qwindowsvistastyle_p.h" -#endif - -#if QT_CONFIG(style_mac) -# include "qmacstyle_mac_p.h" #endif QT_BEGIN_NAMESPACE @@ -105,30 +95,11 @@ QStyle *QStyleFactory::create(const QString& key) ret = new QWindowsStyle; else #endif -#if QT_CONFIG(style_windowsvista) - if (style == QLatin1String("windowsvista")) - ret = new QWindowsVistaStyle; - else -#endif #if QT_CONFIG(style_fusion) if (style == QLatin1String("fusion")) ret = new QFusionStyle; else #endif -#if QT_CONFIG(style_android) - if (style == QLatin1String("android")) - ret = new QAndroidStyle; - else -#endif -#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 - if (style == QLatin1String("macintosh")) - style += QLatin1String(" (aqua)"); -# endif - } else -#endif { } // Keep these here - they make the #ifdefery above work if (!ret) ret = qLoadPlugin<QStyle, QStylePlugin>(loader(), style); @@ -156,27 +127,10 @@ QStringList QStyleFactory::keys() if (!list.contains(QLatin1String("Windows"))) list << QLatin1String("Windows"); #endif -#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 -#if QT_CONFIG(style_android) - if (!list.contains(QLatin1String("Android"))) - list << QLatin1String("Android"); -#endif #if QT_CONFIG(style_fusion) if (!list.contains(QLatin1String("Fusion"))) list << QLatin1String("Fusion"); #endif -#if QT_CONFIG(style_mac) - QString mstyle = QLatin1String("Macintosh"); -# if 0 // Used to be included in Qt4 for Q_WS_MAC - mstyle += QLatin1String(" (aqua)"); -# endif - if (!list.contains(mstyle)) - list << mstyle; -#endif return list; } diff --git a/src/widgets/styles/qstylehelper_p.h b/src/widgets/styles/qstylehelper_p.h index 8c30d3f4eb..aa6cbaad78 100644 --- a/src/widgets/styles/qstylehelper_p.h +++ b/src/widgets/styles/qstylehelper_p.h @@ -71,27 +71,27 @@ class QWindow; namespace QStyleHelper { QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size); - qreal dpiScaled(qreal value); + Q_WIDGETS_EXPORT qreal dpiScaled(qreal value); #ifndef QT_NO_DIAL qreal angle(const QPointF &p1, const QPointF &p2); QPolygonF calcLines(const QStyleOptionSlider *dial); int calcBigLineSize(int radius); - void drawDial(const QStyleOptionSlider *dial, QPainter *painter); + Q_WIDGETS_EXPORT void drawDial(const QStyleOptionSlider *dial, QPainter *painter); #endif //QT_NO_DIAL - void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rect, + Q_WIDGETS_EXPORT void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rect, int left = 0, int top = 0, int right = 0, int bottom = 0); #ifndef QT_NO_ACCESSIBILITY - bool isInstanceOf(QObject *obj, QAccessible::Role role); - bool hasAncestor(QObject *obj, QAccessible::Role role); + Q_WIDGETS_EXPORT bool isInstanceOf(QObject *obj, QAccessible::Role role); + Q_WIDGETS_EXPORT bool hasAncestor(QObject *obj, QAccessible::Role role); #endif - QColor backgroundColor(const QPalette &pal, const QWidget* widget = 0); - QWindow *styleObjectWindow(QObject *so); + Q_WIDGETS_EXPORT QColor backgroundColor(const QPalette &pal, const QWidget* widget = 0); + Q_WIDGETS_EXPORT QWindow *styleObjectWindow(QObject *so); enum WidgetSizePolicy { SizeSmall, SizeLarge, SizeMini, SizeDefault }; void setWidgetSizePolicy(const QWidget *w, WidgetSizePolicy policy); - WidgetSizePolicy widgetSizePolicy(const QWidget *w, const QStyleOption *opt = 0); + Q_WIDGETS_EXPORT WidgetSizePolicy widgetSizePolicy(const QWidget *w, const QStyleOption *opt = 0); } diff --git a/src/widgets/styles/qwindowsstyle_p.h b/src/widgets/styles/qwindowsstyle_p.h index a1d65610ff..12a682f330 100644 --- a/src/widgets/styles/qwindowsstyle_p.h +++ b/src/widgets/styles/qwindowsstyle_p.h @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE class QWindowsStylePrivate; -class QWindowsStyle : public QCommonStyle +class Q_WIDGETS_EXPORT QWindowsStyle : public QCommonStyle { Q_OBJECT public: diff --git a/src/widgets/styles/qwindowsstyle_p_p.h b/src/widgets/styles/qwindowsstyle_p_p.h index 5023fd1042..8b387b6ab9 100644 --- a/src/widgets/styles/qwindowsstyle_p_p.h +++ b/src/widgets/styles/qwindowsstyle_p_p.h @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE class QTime; -class QWindowsStylePrivate : public QCommonStylePrivate +class Q_WIDGETS_EXPORT QWindowsStylePrivate : public QCommonStylePrivate { Q_DECLARE_PUBLIC(QWindowsStyle) public: diff --git a/src/widgets/styles/styles.pri b/src/widgets/styles/styles.pri index 4c13311ebc..0c0f8b7bc7 100644 --- a/src/widgets/styles/styles.pri +++ b/src/widgets/styles/styles.pri @@ -37,22 +37,6 @@ RESOURCES += styles/qstyle.qrc include($$OUT_PWD/qtwidgets-config.pri) -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 -} - -qtConfig(style-windowsvista) { - HEADERS += styles/qwindowsvistastyle_p.h styles/qwindowsvistastyle_p_p.h - SOURCES += styles/qwindowsvistastyle.cpp - - HEADERS += styles/qwindowsxpstyle_p.h styles/qwindowsxpstyle_p_p.h - SOURCES += styles/qwindowsxpstyle.cpp -} - qtConfig(style-windows) { HEADERS += styles/qwindowsstyle_p.h styles/qwindowsstyle_p_p.h SOURCES += styles/qwindowsstyle.cpp @@ -62,8 +46,3 @@ qtConfig(style-fusion) { HEADERS += styles/qfusionstyle_p.h styles/qfusionstyle_p_p.h SOURCES += styles/qfusionstyle.cpp } - -qtConfig(style-android) { - HEADERS += styles/qandroidstyle_p.h - SOURCES += styles/qandroidstyle.cpp -} diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h index 6c36359f81..2340f06954 100644 --- a/src/widgets/widgets/qcombobox_p.h +++ b/src/widgets/widgets/qcombobox_p.h @@ -212,7 +212,7 @@ private: bool fast; }; -class Q_AUTOTEST_EXPORT QComboBoxPrivateContainer : public QFrame +class Q_WIDGETS_EXPORT QComboBoxPrivateContainer : public QFrame { Q_OBJECT diff --git a/src/widgets/widgets/qtabbar_p.h b/src/widgets/widgets/qtabbar_p.h index 7c653a95e9..7b14b636d1 100644 --- a/src/widgets/widgets/qtabbar_p.h +++ b/src/widgets/widgets/qtabbar_p.h @@ -81,7 +81,7 @@ private: QPixmap m_pixmap; }; -class QTabBarPrivate : public QWidgetPrivate +class Q_WIDGETS_EXPORT QTabBarPrivate : public QWidgetPrivate { Q_DECLARE_PUBLIC(QTabBar) public: |