Factor out QPlatformTheme from QPlatformPlugin.
Implement QCocoaPlatformTheme. The menus and dialog API is moved from the platform to the theme plugin. (Both APIs contain references to QtWidget classes, which we are working towards removing.) The theme plugin is created after the platform plugin, first by asking the platform plugin, then by looking for a separate plugin if the platform does not specify a theme. Initial-patch-by: Morten Sorvig <msorvig@trolltech.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Change-Id: I2778cdd3a205c4ce35ead93e39fe6b4cd58a39f9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This commit is contained in:
parent
c92d6130fe
commit
4e732b87d2
@ -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 \
|
||||
|
@ -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()) {
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
};
|
||||
|
70
src/gui/kernel/qplatformtheme_qpa.cpp
Normal file
70
src/gui/kernel/qplatformtheme_qpa.cpp
Normal file
@ -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
|
74
src/gui/kernel/qplatformtheme_qpa.h
Normal file
74
src/gui/kernel/qplatformtheme_qpa.h
Normal file
@ -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
|
108
src/gui/kernel/qplatformthemefactory_qpa.cpp
Normal file
108
src/gui/kernel/qplatformthemefactory_qpa.cpp
Normal file
@ -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
|
77
src/gui/kernel/qplatformthemefactory_qpa_p.h
Normal file
77
src/gui/kernel/qplatformthemefactory_qpa_p.h
Normal file
@ -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
|
55
src/gui/kernel/qplatformthemeplugin_qpa.cpp
Normal file
55
src/gui/kernel/qplatformthemeplugin_qpa.cpp
Normal file
@ -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
|
92
src/gui/kernel/qplatformthemeplugin_qpa.h
Normal file
92
src/gui/kernel/qplatformthemeplugin_qpa.h
Normal file
@ -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
|
@ -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 \
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
66
src/plugins/platforms/cocoa/qcocoatheme.h
Normal file
66
src/plugins/platforms/cocoa/qcocoatheme.h
Normal file
@ -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
|
93
src/plugins/platforms/cocoa/qcocoatheme.mm
Normal file
93
src/plugins/platforms/cocoa/qcocoatheme.mm
Normal file
@ -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
|
@ -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:
|
||||
|
@ -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>
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
61
src/plugins/platforms/windows/qwindowstheme.cpp
Normal file
61
src/plugins/platforms/windows/qwindowstheme.cpp
Normal file
@ -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
|
60
src/plugins/platforms/windows/qwindowstheme.h
Normal file
60
src/plugins/platforms/windows/qwindowstheme.h
Normal file
@ -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
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user