Fix creation of QPlatformTheme on UNIX platforms.

On Ubuntu 14.04.1 LTS, a file /etc/profile.d/appmenu-qt5.sh appeared,
exporting QT_QPA_PLATFORMTHEME=appmenu-qt5 (application menu theme plugin).

This caused QGenericUnixTheme::createUnixTheme() to return an
instance of QGenericUnixTheme by theme name instead of the appropriate
QKdeTheme, QGnomeTheme.

Fix this by always appending the generic theme name to the list
of available themes and returning it only if the name matches.

Qt 5 applications will now appear correctly themed on Ubuntu,
including theme icons.

Change-Id: I68fcd80a620b74e2af73e938253dba9933816336
Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
This commit is contained in:
Friedemann Kleint 2015-07-21 13:21:14 +02:00
parent 0e72782363
commit fa542b2ab6

View File

@ -678,7 +678,7 @@ QPlatformTheme *QGenericUnixTheme::createUnixTheme(const QString &name)
#endif
if (name == QLatin1String(QGnomeTheme::name))
return new QGnomeTheme;
return new QGenericUnixTheme;
return Q_NULLPTR;
}
QStringList QGenericUnixTheme::themeNames()
@ -710,8 +710,7 @@ QStringList QGenericUnixTheme::themeNames()
if (!session.isEmpty() && session != QLatin1String("default") && !result.contains(session))
result.push_back(session);
} // desktopSettingsAware
if (result.isEmpty())
result.push_back(QLatin1String(QGenericUnixTheme::name));
result.append(QLatin1String(QGenericUnixTheme::name));
return result;
}