diff options
27 files changed, 846 insertions, 111 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index d01e39c962..c6f6cab5da 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -16,6 +16,9 @@ HEADERS += \ kernel/qplatforminputcontext_qpa.h \ kernel/qplatformintegrationfactory_qpa_p.h \ kernel/qplatformintegrationplugin_qpa.h \ + kernel/qplatformtheme_qpa.h\ + kernel/qplatformthemefactory_qpa_p.h \ + kernel/qplatformthemeplugin_qpa.h \ kernel/qplatformwindow_qpa.h \ kernel/qplatformopenglcontext_qpa.h \ kernel/qopenglcontext.h \ @@ -60,6 +63,9 @@ SOURCES += \ kernel/qplatformscreen_qpa.cpp \ kernel/qplatformintegrationfactory_qpa.cpp \ kernel/qplatformintegrationplugin_qpa.cpp \ + kernel/qplatformtheme_qpa.cpp \ + kernel/qplatformthemefactory_qpa.cpp \ + kernel/qplatformthemeplugin_qpa.cpp \ kernel/qplatformwindow_qpa.cpp \ kernel/qplatformopenglcontext_qpa.cpp \ kernel/qopenglcontext.cpp \ diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 1dab8a7d62..07e9489ddc 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -62,6 +62,8 @@ #include <QtGui/QGenericPluginFactory> #include <QtGui/qstylehints.h> #include <QtGui/qinputpanel.h> +#include <QtGui/qplatformtheme_qpa.h> + #include <QWindowSystemInterface> #include "private/qwindowsysteminterface_qpa_p.h" @@ -69,6 +71,7 @@ #include "private/qkeymapper_p.h" #include "private/qcursor_p.h" #include "private/qdnd_p.h" +#include <private/qplatformthemefactory_qpa_p.h> #ifndef QT_NO_CURSOR #include "qplatformcursor_qpa.h" #endif @@ -89,6 +92,7 @@ Qt::KeyboardModifiers QGuiApplicationPrivate::modifier_buttons = Qt::NoModifier; QPointF QGuiApplicationPrivate::lastCursorPosition(0.0, 0.0); QPlatformIntegration *QGuiApplicationPrivate::platform_integration = 0; +QPlatformTheme *QGuiApplicationPrivate::platform_theme = 0; QList<QObject *> QGuiApplicationPrivate::generic_plugin_list; @@ -257,6 +261,7 @@ static void init_platform(const QString &pluginArgument, const QString &platform } } + // Create the platform integration. QGuiApplicationPrivate::platform_integration = QPlatformIntegrationFactory::create(name, platformPluginPath); if (!QGuiApplicationPrivate::platform_integration) { QStringList keys = QPlatformIntegrationFactory::keys(platformPluginPath); @@ -268,6 +273,22 @@ static void init_platform(const QString &pluginArgument, const QString &platform qFatal("%s", fatalMessage.toLocal8Bit().constData()); return; } + + // Create the platform theme: + // 1) Ask the platform integration to create a platform theme + QGuiApplicationPrivate::platform_theme = QGuiApplicationPrivate::platform_integration->platformTheme(); + + // 2) If none found, look for a theme plugin. Theme plugins are located in the + // same directory as platform plugins. + if (!QGuiApplicationPrivate::platform_theme) { + QGuiApplicationPrivate::platform_theme = QPlatformThemeFactory::create(name, platformPluginPath); + // No error message; not having a theme plugin is allowed. + } + + // 3) Fall back on the built-in "null" platform theme. + if (!QGuiApplicationPrivate::platform_theme) + QGuiApplicationPrivate::platform_theme = new QPlatformTheme; + // Set arguments as dynamic properties on the native interface as // boolean 'foo' or strings: 'foo=bar' if (!arguments.isEmpty()) { diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index bd42fa1904..af1c71d478 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -51,7 +51,8 @@ #include <QWindowSystemInterface> #include "private/qwindowsysteminterface_qpa_p.h" -#include "QtGui/qplatformintegration_qpa.h" +#include <QtGui/qplatformintegration_qpa.h> +#include <QtGui/qplatformtheme_qpa.h> QT_BEGIN_HEADER @@ -81,6 +82,12 @@ public: static QPlatformIntegration *platformIntegration() { return platform_integration; } + static QPlatformTheme *platform_theme; + + static QPlatformTheme *platformTheme() + { return platform_theme; } + + enum KeyPlatform { KB_Win = 1, KB_Mac = 2, diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp index 605cc5de59..956180c728 100644 --- a/src/gui/kernel/qplatformintegration_qpa.cpp +++ b/src/gui/kernel/qplatformintegration_qpa.cpp @@ -238,30 +238,6 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const return 0; } -QPlatformMenu *QPlatformIntegration::createPlatformMenu(QMenu *menu) const -{ - Q_UNUSED(menu); - return 0; -} - -QPlatformMenuBar *QPlatformIntegration::createPlatformMenuBar(QMenuBar *menuBar) const -{ - Q_UNUSED(menuBar); - return 0; -} - -bool QPlatformIntegration::usePlatformNativeDialog(QDialog *dialog) const -{ - Q_UNUSED(dialog); - return false; -} - -QPlatformDialogHelper * QPlatformIntegration::createPlatformDialogHelper(QDialog *dialog) const -{ - Q_UNUSED(dialog); - return 0; -} - /*! Should be called by the implementation whenever a new screen is added. @@ -282,4 +258,9 @@ void QPlatformIntegration::screenAdded(QPlatformScreen *ps) } } +class QPlatformTheme *QPlatformIntegration::platformTheme() const +{ + return 0; +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index 6dd87495b4..d5eb14bc50 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -63,12 +63,8 @@ class QPlatformOpenGLContext; class QGuiGLFormat; class QAbstractEventDispatcher; class QPlatformInputContext; -class QMenu; -class QMenuBar; -class QPlatformMenu; -class QPlatformMenuBar; class QPlatformAccessibility; -class QPlatformDialogHelper; +class QPlatformTheme; class Q_GUI_EXPORT QPlatformIntegration { @@ -100,15 +96,9 @@ public: virtual QPlatformDrag *drag() const; #endif virtual QPlatformInputContext *inputContext() const; - - virtual QPlatformMenu *createPlatformMenu(QMenu *menu = 0) const; - virtual QPlatformMenuBar *createPlatformMenuBar(QMenuBar *menuBar = 0) const; virtual QPlatformAccessibility *accessibility() const; - virtual bool usePlatformNativeDialog(QDialog *dialog = 0) const; - virtual QPlatformDialogHelper *createPlatformDialogHelper(QDialog *dialog = 0) const; - -// Access native handles. The window handle is already available from Wid; + // Access native handles. The window handle is already available from Wid; virtual QPlatformNativeInterface *nativeInterface() const; enum StyleHint { @@ -121,6 +111,8 @@ public: virtual QVariant styleHint(StyleHint hint) const; + virtual QPlatformTheme *platformTheme() const; + protected: void screenAdded(QPlatformScreen *screen); }; diff --git a/src/gui/kernel/qplatformtheme_qpa.cpp b/src/gui/kernel/qplatformtheme_qpa.cpp new file mode 100644 index 0000000000..c887d78edb --- /dev/null +++ b/src/gui/kernel/qplatformtheme_qpa.cpp @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatformtheme_qpa.h" + +QT_BEGIN_NAMESPACE + +QPlatformMenu *QPlatformTheme::createPlatformMenu(QMenu *menu) const +{ + Q_UNUSED(menu); + return 0; +} + +QPlatformMenuBar *QPlatformTheme::createPlatformMenuBar(QMenuBar *menuBar) const +{ + Q_UNUSED(menuBar); + return 0; +} + +bool QPlatformTheme::usePlatformNativeDialog(const QDialog *dialog) const +{ + Q_UNUSED(dialog); + return false; +} + +QPlatformDialogHelper *QPlatformTheme::createPlatformDialogHelper(QDialog *dialog) const +{ + Q_UNUSED(dialog); + return 0; +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformtheme_qpa.h b/src/gui/kernel/qplatformtheme_qpa.h new file mode 100644 index 0000000000..2090ce37e1 --- /dev/null +++ b/src/gui/kernel/qplatformtheme_qpa.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMTHEME_H +#define QPLATFORMTHEME_H + +#include <QtCore/QtGlobal> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QMenu; +class QMenuBar; +class QPlatformMenu; +class QPlatformMenuBar; +class QPlatformDialogHelper; +class QDialog; + +class Q_GUI_EXPORT QPlatformTheme +{ +public: + virtual QPlatformMenu *createPlatformMenu(QMenu *menu = 0) const; + virtual QPlatformMenuBar *createPlatformMenuBar(QMenuBar *menuBar = 0) const; + + virtual bool usePlatformNativeDialog(const QDialog *dialog = 0) const; + virtual QPlatformDialogHelper *createPlatformDialogHelper(QDialog *dialog = 0) const; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPLATFORMTHEME_H diff --git a/src/gui/kernel/qplatformthemefactory_qpa.cpp b/src/gui/kernel/qplatformthemefactory_qpa.cpp new file mode 100644 index 0000000000..87f96762c2 --- /dev/null +++ b/src/gui/kernel/qplatformthemefactory_qpa.cpp @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatformthemefactory_qpa_p.h" +#include <QPlatformThemePlugin> +#include "private/qfactoryloader_p.h" +#include "qmutex.h" + +#include "qguiapplication.h" +#include "qdebug.h" + +QT_BEGIN_NAMESPACE + +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) +Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, + (QPlatformThemeFactoryInterface_iid, QLatin1String("/platformthemes"), Qt::CaseInsensitive)) +Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, + (QPlatformThemeFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive)) +#endif + +QPlatformTheme *QPlatformThemeFactory::create(const QString& key, const QString &platformPluginPath) +{ + QPlatformTheme *ret = 0; + QStringList paramList = key.split(QLatin1Char(':')); + QString platform = paramList.takeFirst().toLower(); + +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) + // Try loading the plugin from platformPluginPath first: + if (!platformPluginPath.isEmpty()) { + QCoreApplication::addLibraryPath(platformPluginPath); + if (QPlatformThemeFactoryInterface *factory = + qobject_cast<QPlatformThemeFactoryInterface*>(directLoader()->instance(platform))) + ret = factory->create(key, paramList); + + if (ret) + return ret; + } + if (QPlatformThemeFactoryInterface *factory = qobject_cast<QPlatformThemeFactoryInterface*>(loader()->instance(platform))) + ret = factory->create(platform, paramList); +#endif + + return ret; +} + +/*! + Returns the list of valid keys, i.e. the keys this factory can + create styles for. + + \sa create() +*/ +QStringList QPlatformThemeFactory::keys(const QString &platformPluginPath) +{ +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) + QStringList list; + + if (!platformPluginPath.isEmpty()) { + QCoreApplication::addLibraryPath(platformPluginPath); + foreach (const QString &key, directLoader()->keys()) { + list += key + QString(QLatin1String(" (from %1)")).arg(platformPluginPath); + } + } + + list += loader()->keys(); +#else + QStringList list; +#endif + return list; +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformthemefactory_qpa_p.h b/src/gui/kernel/qplatformthemefactory_qpa_p.h new file mode 100644 index 0000000000..b65e6e197a --- /dev/null +++ b/src/gui/kernel/qplatformthemefactory_qpa_p.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMTHEMEFACTORY_H +#define QPLATFORMTHEMEFACTORY_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtCore/qstringlist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QPlatformTheme; + +class QPlatformThemeFactory +{ +public: + static QStringList keys(const QString &platformPluginPath = QString()); + static QPlatformTheme *create(const QString &key, const QString &platformPluginPath = QString()); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPLATFORMTHEMEFACTORY_H diff --git a/src/gui/kernel/qplatformthemeplugin_qpa.cpp b/src/gui/kernel/qplatformthemeplugin_qpa.cpp new file mode 100644 index 0000000000..e17e36fc3d --- /dev/null +++ b/src/gui/kernel/qplatformthemeplugin_qpa.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatformthemeplugin_qpa.h" + +QT_BEGIN_NAMESPACE + +QPlatformThemePlugin::QPlatformThemePlugin(QObject *parent) + : QObject(parent) +{ +} + +QPlatformThemePlugin::~QPlatformThemePlugin() +{ +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformthemeplugin_qpa.h b/src/gui/kernel/qplatformthemeplugin_qpa.h new file mode 100644 index 0000000000..0df9a8842d --- /dev/null +++ b/src/gui/kernel/qplatformthemeplugin_qpa.h @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMTHEMEPLUGIN_H +#define QPLATFORMTHEMEPLUGIN_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtCore/qplugin.h> +#include <QtCore/qfactoryinterface.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QPlatformTheme; + +struct QPlatformThemeFactoryInterface : public QFactoryInterface +{ + virtual QPlatformTheme *create(const QString &key, const QStringList ¶mList) = 0; +}; + +#define QPlatformThemeFactoryInterface_iid "com.nokia.Qt.QPlatformThemeFactoryInterface" + +Q_DECLARE_INTERFACE(QPlatformThemeFactoryInterface, QPlatformThemeFactoryInterface_iid) + +class Q_GUI_EXPORT QPlatformThemePlugin : public QObject, public QPlatformThemeFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QPlatformThemeFactoryInterface:QFactoryInterface) +public: + explicit QPlatformThemePlugin(QObject *parent = 0); + ~QPlatformThemePlugin(); + + virtual QStringList keys() const = 0; + virtual QPlatformTheme *create(const QString &key, const QStringList ¶mList) = 0; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPLATFORMTHEMEPLUGIN_H diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro index 5531c49e23..3d42b02df6 100644 --- a/src/plugins/platforms/cocoa/cocoa.pro +++ b/src/plugins/platforms/cocoa/cocoa.pro @@ -4,6 +4,7 @@ DESTDIR = $$QT.gui.plugins/platforms OBJECTIVE_SOURCES += main.mm \ qcocoaintegration.mm \ + qcocoatheme.mm \ qcocoabackingstore.mm \ qcocoawindow.mm \ qnsview.mm \ @@ -26,6 +27,7 @@ OBJECTIVE_SOURCES += main.mm \ qcocoacursor.mm \ HEADERS += qcocoaintegration.h \ + qcocoatheme.h \ qcocoabackingstore.h \ qcocoawindow.h \ qnsview.h \ diff --git a/src/plugins/platforms/cocoa/main.mm b/src/plugins/platforms/cocoa/main.mm index 1ef7d622e8..0be6ebd682 100644 --- a/src/plugins/platforms/cocoa/main.mm +++ b/src/plugins/platforms/cocoa/main.mm @@ -42,7 +42,9 @@ #include <Cocoa/Cocoa.h> #include <QtGui/QPlatformIntegrationPlugin> +#include <QtGui/QPlatformThemePlugin> #include "qcocoaintegration.h" +#include "qcocoatheme.h" QT_BEGIN_NAMESPACE @@ -69,6 +71,6 @@ QPlatformIntegration * QCocoaIntegrationPlugin::create(const QString& system, co return 0; } -Q_EXPORT_PLUGIN2(Cocoa, QCocoaIntegrationPlugin) +Q_EXPORT_PLUGIN2(CocoaIntegration, QCocoaIntegrationPlugin) QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h index 9cba69da3a..5311eaff83 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.h +++ b/src/plugins/platforms/cocoa/qcocoaintegration.h @@ -84,20 +84,18 @@ public: QAbstractEventDispatcher *guiThreadEventDispatcher() const; QPlatformFontDatabase *fontDatabase() const; - QPlatformMenu *createPlatformMenu(QMenu *menu = 0) const; - QPlatformMenuBar *createPlatformMenuBar(QMenuBar *menuBar = 0) const; - - bool usePlatformNativeDialog(QDialog *dialog = 0) const; - QPlatformDialogHelper *createPlatformDialogHelper(QDialog *dialog = 0) const; QPlatformNativeInterface *nativeInterface() const; QPlatformAccessibility *accessibility() const; + + QPlatformTheme *platformTheme() const; private: QPlatformFontDatabase *mFontDb; QAbstractEventDispatcher *mEventDispatcher; QCocoaAutoReleasePool *mPool; QPlatformAccessibility *mAccessibility; + QPlatformTheme *mPlatformTheme; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index b1926eb6e8..f7f8452e5a 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -51,6 +51,7 @@ #include "qcocoaapplicationdelegate.h" #include "qmenu_mac.h" #include "qcocoafiledialoghelper.h" +#include "qcocoatheme.h" #include <QtGui/qplatformaccessibility_qpa.h> #include <QtCore/qcoreapplication.h> @@ -134,6 +135,7 @@ QCocoaIntegration::QCocoaIntegration() } mAccessibility = new QPlatformAccessibility; + mPlatformTheme = new QCocoaTheme; } QCocoaIntegration::~QCocoaIntegration() @@ -179,16 +181,6 @@ QPlatformFontDatabase *QCocoaIntegration::fontDatabase() const return mFontDb; } -QPlatformMenu *QCocoaIntegration::createPlatformMenu(QMenu *menu) const -{ - return new QCocoaMenu(menu); -} - -QPlatformMenuBar *QCocoaIntegration::createPlatformMenuBar(QMenuBar *menuBar) const -{ - return new QCocoaMenuBar(menuBar); -} - QPlatformNativeInterface *QCocoaIntegration::nativeInterface() const { return new QCocoaNativeInterface(); @@ -199,26 +191,9 @@ QPlatformAccessibility *QCocoaIntegration::accessibility() const return mAccessibility; } -bool QCocoaIntegration::usePlatformNativeDialog(QDialog *dialog) const +QPlatformTheme *QCocoaIntegration::platformTheme() const { - Q_UNUSED(dialog); - return true; -#if 0 - QFileDialog *fileDialog = qobject_cast<QFileDialog*>(dialog); - if (fileDialog) { - return true; - } - return false; -#endif -} - -QPlatformDialogHelper * QCocoaIntegration::createPlatformDialogHelper(QDialog *dialog) const -{ - QFileDialog *fileDialog = qobject_cast<QFileDialog*>(dialog); - if (fileDialog) { - return new QCocoaFileDialogHelper(fileDialog); - } - return 0; + return mPlatformTheme; } QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoatheme.h b/src/plugins/platforms/cocoa/qcocoatheme.h new file mode 100644 index 0000000000..8a7add73a8 --- /dev/null +++ b/src/plugins/platforms/cocoa/qcocoatheme.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMTHEME_COCOA_H +#define QPLATFORMTHEME_COCOA_H + +#include <Cocoa/Cocoa.h> + +#include <QtGui/QPlatformTheme> + +QT_BEGIN_NAMESPACE + +class QCocoaTheme : public QPlatformTheme +{ +public: + QCocoaTheme(); + ~QCocoaTheme(); + + QPlatformMenu *createPlatformMenu(QMenu *menu = 0) const; + QPlatformMenuBar *createPlatformMenuBar(QMenuBar *menuBar = 0) const; + + bool usePlatformNativeDialog(const QDialog *dialog = 0) const; + QPlatformDialogHelper *createPlatformDialogHelper(QDialog *dialog = 0) const; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm new file mode 100644 index 0000000000..ef73cc2abe --- /dev/null +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qcocoatheme.h" + +#include "qmenu_mac.h" +#include "qcocoafiledialoghelper.h" +#include <QtWidgets/QFileDialog> + +QT_BEGIN_NAMESPACE + +QCocoaTheme::QCocoaTheme() +{ + +} + +QCocoaTheme::~QCocoaTheme() +{ + +} + +QPlatformMenu *QCocoaTheme::createPlatformMenu(QMenu *menu) const +{ + return new QCocoaMenu(menu); +} + +QPlatformMenuBar *QCocoaTheme::createPlatformMenuBar(QMenuBar *menuBar) const +{ + return new QCocoaMenuBar(menuBar); +} + + +bool QCocoaTheme::usePlatformNativeDialog(const QDialog *dialog) const +{ + Q_UNUSED(dialog); + return true; +#if 0 + QFileDialog *fileDialog = qobject_cast<QFileDialog*>(dialog); + if (fileDialog) { + return true; + } + return false; +#endif +} + +QPlatformDialogHelper * QCocoaTheme::createPlatformDialogHelper(QDialog *dialog) const +{ + QFileDialog *fileDialog = qobject_cast<QFileDialog*>(dialog); + if (fileDialog) { + return new QCocoaFileDialogHelper(fileDialog); + } + return 0; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp index 82fbd8c712..bd10efede1 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -1317,16 +1317,18 @@ namespace QWindowsDialogs { // QWindowsDialogHelperBase creation functions bool useHelper(const QDialog *dialog) { - switch (QWindowsDialogs::dialogType(dialog)) { - case QWindowsDialogs::FileDialog: - return true; - case QWindowsDialogs::ColorDialog: + if (dialog) { + switch (QWindowsDialogs::dialogType(dialog)) { + case QWindowsDialogs::FileDialog: + return true; + case QWindowsDialogs::ColorDialog: #ifdef USE_NATIVE_COLOR_DIALOG - return true; + return true; #endif - case QWindowsDialogs::FontDialog: - case QWindowsDialogs::UnknownType: - break; + case QWindowsDialogs::FontDialog: + case QWindowsDialogs::UnknownType: + break; + } } return false; } @@ -1335,6 +1337,8 @@ QPlatformDialogHelper *createHelper(QDialog *dialog) { if (QWindowsContext::verboseDialogs) qDebug("%s %p %s" , __FUNCTION__, dialog, dialog->metaObject()->className()); + if (!dialog) + return 0; switch (QWindowsDialogs::dialogType(dialog)) { case QWindowsDialogs::FileDialog: diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.h b/src/plugins/platforms/windows/qwindowsdialoghelpers.h index 99f3c0b2d2..96c03bbaec 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.h +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.h @@ -61,8 +61,8 @@ namespace QWindowsDialogs Type dialogType(const QDialog *dialog); void eatMouseMove(); - bool useHelper(const QDialog *dialog); - QPlatformDialogHelper *createHelper(QDialog *dialog); + bool useHelper(const QDialog *dialog = 0); + QPlatformDialogHelper *createHelper(QDialog *dialog = 0); } // namespace QWindowsDialogs template <class BaseClass> diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 4ffbdb7491..cebb17c9c7 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -45,6 +45,7 @@ #include "qwindowscontext.h" #include "qwindowsglcontext.h" #include "qwindowsscreen.h" +#include "qwindowstheme.h" #ifndef QT_NO_FREETYPE #include "qwindowsfontdatabase_ft.h" #endif @@ -54,7 +55,6 @@ #include "qwindowsdrag.h" #include "qwindowsinputcontext.h" #include "qwindowsaccessibility.h" -#include "qwindowsdialoghelpers.h" #include <QtGui/QPlatformNativeInterface> #include <QtGui/QWindowSystemInterface> @@ -159,6 +159,7 @@ struct QWindowsIntegrationPrivate QOpenGLStaticContextPtr m_staticOpenGLContext; QWindowsInputContext m_inputContext; QWindowsAccessibility m_accessibility; + QWindowsTheme m_theme; }; QWindowsIntegrationPrivate::QWindowsIntegrationPrivate() @@ -322,17 +323,9 @@ QAbstractEventDispatcher * QWindowsIntegration::guiThreadEventDispatcher() const return d->m_eventDispatcher; } -#ifdef QT_WIDGETS_LIB -bool QWindowsIntegration::usePlatformNativeDialog(QDialog *dialog) const +QPlatformTheme *QWindowsIntegration::platformTheme() const { - return QWindowsDialogs::useHelper(dialog); + return &d->m_theme; } -QPlatformDialogHelper *QWindowsIntegration::createPlatformDialogHelper(QDialog *dialog) const -{ - return QWindowsDialogs::createHelper(dialog); -} - -#endif // QT_WIDGETS_LIB - QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h index ad5493015a..1c2a714fcb 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.h +++ b/src/plugins/platforms/windows/qwindowsintegration.h @@ -69,13 +69,9 @@ public: virtual QPlatformAccessibility *accessibility() const; virtual QPlatformNativeInterface *nativeInterface() const; virtual QPlatformFontDatabase *fontDatabase() const; + virtual QPlatformTheme *platformTheme() const; virtual QVariant styleHint(StyleHint hint) const; -#ifdef QT_WIDGETS_LIB - virtual bool usePlatformNativeDialog(QDialog *dialog = 0) const; - virtual QPlatformDialogHelper *createPlatformDialogHelper(QDialog *dialog = 0) const; -#endif // QT_WIDGETS_LIB - static QWindowsIntegration *instance(); private: diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp new file mode 100644 index 0000000000..a7001719fe --- /dev/null +++ b/src/plugins/platforms/windows/qwindowstheme.cpp @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowstheme.h" +#include "qwindowsdialoghelpers.h" + +QT_BEGIN_NAMESPACE + +QWindowsTheme::QWindowsTheme() +{ +} + +bool QWindowsTheme::usePlatformNativeDialog(const QDialog *dialog) const +{ + return QWindowsDialogs::useHelper(dialog); +} + +QPlatformDialogHelper *QWindowsTheme::createPlatformDialogHelper(QDialog *dialog) const +{ + return QWindowsDialogs::createHelper(dialog); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowstheme.h b/src/plugins/platforms/windows/qwindowstheme.h new file mode 100644 index 0000000000..057e30d262 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowstheme.h @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSTHEME_H +#define QWINDOWSTHEME_H + +#include <QtGui/QPlatformTheme> + +QT_BEGIN_NAMESPACE + +class QWindowsTheme : public QPlatformTheme +{ +public: + QWindowsTheme(); + + virtual bool usePlatformNativeDialog(const QDialog *dialog = 0) const; + virtual QPlatformDialogHelper *createPlatformDialogHelper(QDialog *dialog = 0) const; +}; + +QT_END_NAMESPACE + +#endif // QWINDOWSTHEME_H diff --git a/src/plugins/platforms/windows/windows.pro b/src/plugins/platforms/windows/windows.pro index 627df4ab8e..33ca07d134 100644 --- a/src/plugins/platforms/windows/windows.pro +++ b/src/plugins/platforms/windows/windows.pro @@ -4,6 +4,8 @@ load(qt_plugin) QT *= core-private QT *= gui-private QT *= platformsupport-private +# ### fixme: Remove widgets dependencies of dialog helpers +QT *= widgets INCLUDEPATH += ../../../3rdparty/harfbuzz/src QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms @@ -11,6 +13,8 @@ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms # Note: OpenGL32 must precede Gdi32 as it overwrites some functions. LIBS *= -lOpenGL32 -lGdi32 -lUser32 -lOle32 -lWinspool -lImm32 -lWinmm -lOleaut32 win32-g++: LIBS *= -luuid +# For the dialog helpers: +LIBS *= -lshlwapi -lShell32 contains(QT_CONFIG, directwrite) { LIBS *= -ldwrite @@ -41,7 +45,9 @@ SOURCES += \ qwindowscursor.cpp \ pixmaputils.cpp \ qwindowsinputcontext.cpp \ - qwindowsaccessibility.cpp + qwindowsaccessibility.cpp \ + qwindowstheme.cpp \ + qwindowsdialoghelpers.cpp HEADERS += \ qwindowsnativeimage.h \ @@ -67,13 +73,9 @@ HEADERS += \ pixmaputils.h \ array.h \ qwindowsinputcontext.h \ - qwindowsaccessibility.h - -# Dialog helper: Should be used only if QtWidgets is built -QT *= widgets -HEADERS += qwindowsdialoghelpers.h -SOURCES += qwindowsdialoghelpers.cpp -LIBS += -lshlwapi -lShell32 + qwindowsaccessibility.h \ + qwindowstheme.h \ + qwindowsdialoghelpers.h contains(QT_CONFIG, freetype) { DEFINES *= QT_NO_FONTCONFIG diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index a0b0cdc564..363d3bf592 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -66,8 +66,8 @@ QPlatformDialogHelper *QDialogPrivate::platformHelper() const if (!m_platformHelperCreated) { QDialogPrivate *ncThis = const_cast<QDialogPrivate *>(this); m_platformHelperCreated = true; - m_platformHelper = QGuiApplicationPrivate::platformIntegration() - ->createPlatformDialogHelper(ncThis->q_func()); + m_platformHelper = QGuiApplicationPrivate::platformTheme() + ->createPlatformDialogHelper(ncThis->q_func()); if (m_platformHelper) ncThis->initHelper(m_platformHelper); } diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 8b3af3fb25..b8ba2cdf5d 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -161,7 +161,7 @@ void QMenuPrivate::init() scroll->scrollFlags = QMenuPrivate::QMenuScroller::ScrollNone; } - platformMenu = QGuiApplicationPrivate::platformIntegration()->createPlatformMenu(q); + platformMenu = QGuiApplicationPrivate::platformTheme()->createPlatformMenu(q); #ifdef QT_SOFTKEYS_ENABLED selectAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::SelectSoftKey, Qt::Key_Select, q); diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index 6faf8f94ca..1ceea3e78c 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -715,7 +715,7 @@ void QMenuBarPrivate::init() q->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); q->setAttribute(Qt::WA_CustomWhatsThis); - platformMenuBar = QGuiApplicationPrivate::platformIntegration()->createPlatformMenuBar(q); + platformMenuBar = QGuiApplicationPrivate::platformTheme()->createPlatformMenuBar(q); if (platformMenuBar) q->hide(); @@ -1836,7 +1836,7 @@ void QMenuBar::setNativeMenuBar(bool nativeMenuBar) d->platformMenuBar = 0; } else { if (!d->platformMenuBar) - d->platformMenuBar = QGuiApplicationPrivate::platformIntegration()->createPlatformMenuBar(this); + d->platformMenuBar = QGuiApplicationPrivate::platformTheme()->createPlatformMenuBar(this); } updateGeometry(); |