Add QGuiApplication::platformName.
Store the name of the QPA plugin as platformName. Change-Id: Id87cab2a189743c0dd727c86080f7d4595a852bb Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
This commit is contained in:
parent
7f09f36873
commit
259332e655
@ -110,6 +110,7 @@ enum ApplicationResourceFlags
|
|||||||
|
|
||||||
static unsigned applicationResourceFlags = 0;
|
static unsigned applicationResourceFlags = 0;
|
||||||
|
|
||||||
|
QString *QGuiApplicationPrivate::platform_name = 0;
|
||||||
bool QGuiApplicationPrivate::app_do_modal = false;
|
bool QGuiApplicationPrivate::app_do_modal = false;
|
||||||
|
|
||||||
QPalette *QGuiApplicationPrivate::app_pal = 0; // default application palette
|
QPalette *QGuiApplicationPrivate::app_pal = 0; // default application palette
|
||||||
@ -361,6 +362,9 @@ QGuiApplication::~QGuiApplication()
|
|||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
d->cursor_list.clear();
|
d->cursor_list.clear();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
delete QGuiApplicationPrivate::platform_name;
|
||||||
|
QGuiApplicationPrivate::platform_name = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv, int flags)
|
QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv, int flags)
|
||||||
@ -470,6 +474,17 @@ QWindow *QGuiApplication::topLevelAt(const QPoint &pos)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\property QGuiApplication::platformName
|
||||||
|
\brief The name of the underlying platform plugin.
|
||||||
|
\since 5.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
QString QGuiApplication::platformName()
|
||||||
|
{
|
||||||
|
return QGuiApplicationPrivate::platform_name ?
|
||||||
|
*QGuiApplicationPrivate::platform_name : QString();
|
||||||
|
}
|
||||||
|
|
||||||
static void init_platform(const QString &pluginArgument, const QString &platformPluginPath)
|
static void init_platform(const QString &pluginArgument, const QString &platformPluginPath)
|
||||||
{
|
{
|
||||||
@ -509,7 +524,9 @@ static void init_platform(const QString &pluginArgument, const QString &platform
|
|||||||
|
|
||||||
// Create the platform integration.
|
// Create the platform integration.
|
||||||
QGuiApplicationPrivate::platform_integration = QPlatformIntegrationFactory::create(name, platformPluginPath);
|
QGuiApplicationPrivate::platform_integration = QPlatformIntegrationFactory::create(name, platformPluginPath);
|
||||||
if (!QGuiApplicationPrivate::platform_integration) {
|
if (QGuiApplicationPrivate::platform_integration) {
|
||||||
|
QGuiApplicationPrivate::platform_name = new QString(name);
|
||||||
|
} else {
|
||||||
QStringList keys = QPlatformIntegrationFactory::keys(platformPluginPath);
|
QStringList keys = QPlatformIntegrationFactory::keys(platformPluginPath);
|
||||||
QString fatalMessage =
|
QString fatalMessage =
|
||||||
QString::fromLatin1("Failed to load platform plugin \"%1\". Available platforms are: \n").arg(name);
|
QString::fromLatin1("Failed to load platform plugin \"%1\". Available platforms are: \n").arg(name);
|
||||||
|
@ -75,7 +75,7 @@ class Q_GUI_EXPORT QGuiApplication : public QCoreApplication
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection)
|
Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection)
|
||||||
|
Q_PROPERTY(QString platformName READ platformName STORED false)
|
||||||
Q_PROPERTY(bool quitOnLastWindowClosed READ quitOnLastWindowClosed WRITE setQuitOnLastWindowClosed)
|
Q_PROPERTY(bool quitOnLastWindowClosed READ quitOnLastWindowClosed WRITE setQuitOnLastWindowClosed)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -86,6 +86,8 @@ public:
|
|||||||
static QWindowList topLevelWindows();
|
static QWindowList topLevelWindows();
|
||||||
static QWindow *topLevelAt(const QPoint &pos);
|
static QWindow *topLevelAt(const QPoint &pos);
|
||||||
|
|
||||||
|
static QString platformName();
|
||||||
|
|
||||||
#ifdef QT_DEPRECATED
|
#ifdef QT_DEPRECATED
|
||||||
static QT_DEPRECATED QWindow *activeWindow() { return focusWindow(); }
|
static QT_DEPRECATED QWindow *activeWindow() { return focusWindow(); }
|
||||||
#endif
|
#endif
|
||||||
|
@ -146,6 +146,7 @@ public:
|
|||||||
|
|
||||||
static QGuiApplicationPrivate *instance() { return self; }
|
static QGuiApplicationPrivate *instance() { return self; }
|
||||||
|
|
||||||
|
static QString *platform_name;
|
||||||
static bool app_do_modal;
|
static bool app_do_modal;
|
||||||
|
|
||||||
static Qt::MouseButtons buttons;
|
static Qt::MouseButtons buttons;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user