From fa542b2ab66c39099c73ebf25eca9cca2070a8d8 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 21 Jul 2015 13:21:14 +0200 Subject: [PATCH] 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 --- .../themes/genericunix/qgenericunixthemes.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp index ba328bfb411..2e17c3f63c5 100644 --- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp +++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp @@ -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; }