mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 10:22:55 +00:00
smart QGuiPlatformPlugin instance caching
once QCoreApplication/QApplication instance is created the environment lookup stops, this trick can be applied to other environment variable checks Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
48f864a5f4
commit
3a767e2043
1 changed files with 9 additions and 0 deletions
|
@ -46,6 +46,11 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, platformLoader, (QString::fromLatin1("
|
|||
*/
|
||||
QGuiPlatformPlugin *qt_guiPlatformPlugin()
|
||||
{
|
||||
static QGuiPlatformPlugin *appplugin = nullptr;
|
||||
if (appplugin) {
|
||||
return appplugin;
|
||||
}
|
||||
|
||||
QGuiPlatformPlugin *plugin = nullptr;
|
||||
#ifndef QT_NO_LIBRARY
|
||||
static const char* platformEnvTbl[] = {
|
||||
|
@ -72,6 +77,10 @@ QGuiPlatformPlugin *qt_guiPlatformPlugin()
|
|||
plugin = &def;
|
||||
}
|
||||
|
||||
if (qApp) {
|
||||
appplugin = plugin;
|
||||
}
|
||||
|
||||
return plugin;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue