From b30ea419450c968c009ddcae964b1b54755f11ac Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 6 Jan 2016 09:44:11 +0100 Subject: eglfs: use QGenericUnixTheme if requested We need to have reasonable paths for loading icons and such things, just as in any other Unix GUI environment. However there is some concern that it would be too much of a behavior change if there was a theme by default, so for now it's required to set the env var: QT_QPA_PLATFORMTHEME=generic That works because QGuiApplicationPrivate::createPlatformIntegration() reads the env variable and passes platformThemeName to init_platform(). Step 3 in init_platform() does not find a theme plugin by that name (because QGenericUnixTheme is statically linked via libQt5PlatformSupport.a). Then in step 4 it iterates the given platformThemeName plus any which were returned from QPlatformIntegration::themeNames() (which in our case will be an empty list) and calls createPlatformTheme() with each of those, until something is returned. So, QEglFSIntegration::createPlatformTheme() will be called with the value of the QT_QPA_PLATFORMTHEME env var, and QGenericUnixTheme::createUnixTheme() will create the generic, KDE or Gnome theme depending on that value. Change-Id: Id16b881819ba872830b019ab147b32fbc2156520 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/eglfs/qeglfsintegration.cpp | 6 ++++++ src/plugins/platforms/eglfs/qeglfsintegration.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index 7e50b54ec6..3d3381323c 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #include "qeglfsintegration.h" #include "qeglfswindow.h" @@ -173,6 +174,11 @@ QPlatformFontDatabase *QEglFSIntegration::fontDatabase() const return m_fontDb.data(); } +QPlatformTheme *QEglFSIntegration::createPlatformTheme(const QString &name) const +{ + return QGenericUnixTheme::createUnixTheme(name); +} + QPlatformBackingStore *QEglFSIntegration::createPlatformBackingStore(QWindow *window) const { QOpenGLCompositorBackingStore *bs = new QOpenGLCompositorBackingStore(window); diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.h b/src/plugins/platforms/eglfs/qeglfsintegration.h index 73617f7eb9..e06d7e8876 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.h +++ b/src/plugins/platforms/eglfs/qeglfsintegration.h @@ -68,6 +68,7 @@ public: QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE; QPlatformServices *services() const Q_DECL_OVERRIDE; QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE { return m_inputContext; } + QPlatformTheme *createPlatformTheme(const QString &name) const Q_DECL_OVERRIDE; QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE; QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE; -- cgit v1.2.3