QGuiApplication: Report default platform name before initialization
Calling this function before we had a QGuiApplication instance, would return an empty string, even if QT_QPA_DEFAULT_PLATFORM_NAME was defined at compile time. We now return the default platform name [ChangeLog][QtGui][QGuiApplication] QGuiApplication::platformName now reports the default platform name if QGuiApplication hasn't been instantiated yet. It used to return an empty string. Change-Id: Iffe7cde8943ed2d186bc494d0920b9cf79389dd0 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit dd3840a1a201318c8f089dc7d34ec38f64e05b4e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
eb1d0f5d05
commit
bcbbafca88
@ -1194,14 +1194,26 @@ QWindow *QGuiApplication::topLevelAt(const QPoint &pos)
|
||||
\li \c xcb is a plugin for the X11 window system, used on some desktop Linux platforms.
|
||||
\endlist
|
||||
|
||||
\note Calling this function without a QGuiApplication will return the default
|
||||
platform name, if available. The default platform name is not affected by the
|
||||
\c{-platform} command line option, or the \c QT_QPA_PLATFORM environment variable.
|
||||
|
||||
For more information about the platform plugins for embedded Linux devices,
|
||||
see \l{Qt for Embedded Linux}.
|
||||
*/
|
||||
|
||||
QString QGuiApplication::platformName()
|
||||
{
|
||||
return QGuiApplicationPrivate::platform_name ?
|
||||
*QGuiApplicationPrivate::platform_name : QString();
|
||||
if (!QGuiApplication::instance()) {
|
||||
#ifdef QT_QPA_DEFAULT_PLATFORM_NAME
|
||||
return QStringLiteral(QT_QPA_DEFAULT_PLATFORM_NAME);
|
||||
#else
|
||||
return QString();
|
||||
#endif
|
||||
} else {
|
||||
return QGuiApplicationPrivate::platform_name ?
|
||||
*QGuiApplicationPrivate::platform_name : QString();
|
||||
}
|
||||
}
|
||||
|
||||
Q_LOGGING_CATEGORY(lcQpaPluginLoading, "qt.qpa.plugin");
|
||||
|
Loading…
x
Reference in New Issue
Block a user