You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lxqt-qtplugin-packaging/debian/patches/lxqtplatformtheme-follow-co...

81 lines
2.9 KiB

From c78433c32c327d09507976a7b5cecff87c224252 Mon Sep 17 00:00:00 2001
From: Palo Kisa <palo.kisa@gmail.com>
Date: Tue, 13 Feb 2018 10:01:10 +0100
Subject: [PATCH] lxqtplatformtheme: Initialize "folowColorScheme" once
---
src/lxqtplatformtheme.cpp | 18 +++++++++++++-----
src/lxqtplatformtheme.h | 4 +++-
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/src/lxqtplatformtheme.cpp b/src/lxqtplatformtheme.cpp
index 8291eab..467cf07 100644
--- a/src/lxqtplatformtheme.cpp
+++ b/src/lxqtplatformtheme.cpp
@@ -52,13 +52,20 @@ LXQtPlatformTheme::LXQtPlatformTheme():
iconFollowColorScheme_(true)
, settingsWatcher_(NULL)
{
- // When the plugin is loaded, it seems that the app is not yet running and
+ loadSettings();
+ // Note: When the plugin is loaded, it seems that the app is not yet running and
// QThread environment is not completely set up. So creating filesystem watcher
// does not work since it uses QSocketNotifier internally which can only be
// created within QThread thread. So let's schedule a idle handler to initialize
// the watcher in the main event loop.
- loadSettings();
- QTimer::singleShot(0, this, SLOT(initWatch()));
+
+ // Note2: the QTimer::singleShot with also needs a QThread environment
+ // (there is a workaround in qtcore for the 0-timer with the old SLOT notation)
+
+ // TODO: use the "PointerToMemberFunction" overloads of invokeMethod(), but they
+ // are available from Qt v5.10
+ //QMetaObject::ivokeMethod(this, &LXQtPlatformTheme::lazyInit, Qt::QueuedConnection);
+ QMetaObject::invokeMethod(this, "lazyInit", Qt::QueuedConnection);
}
LXQtPlatformTheme::~LXQtPlatformTheme() {
@@ -66,11 +73,13 @@ LXQtPlatformTheme::~LXQtPlatformTheme() {
delete settingsWatcher_;
}
-void LXQtPlatformTheme::initWatch()
+void LXQtPlatformTheme::lazyInit()
{
settingsWatcher_ = new QFileSystemWatcher();
settingsWatcher_->addPath(settingsFile_);
connect(settingsWatcher_, &QFileSystemWatcher::fileChanged, this, &LXQtPlatformTheme::onSettingsChanged);
+
+ XdgIconLoader::instance()->setFollowColorScheme(iconFollowColorScheme_);
}
void LXQtPlatformTheme::loadSettings() {
@@ -315,7 +324,6 @@ QVariant LXQtPlatformTheme::themeHint(ThemeHint hint) const {
QIconEngine *LXQtPlatformTheme::createIconEngine(const QString &iconName) const
{
- XdgIconLoader::instance()->setFollowColorScheme(iconFollowColorScheme_);
return new XdgIconLoaderEngine(iconName);
}
diff --git a/src/lxqtplatformtheme.h b/src/lxqtplatformtheme.h
index 3c07c46..d0e7b6e 100644
--- a/src/lxqtplatformtheme.h
+++ b/src/lxqtplatformtheme.h
@@ -78,11 +78,13 @@ class Q_GUI_EXPORT LXQtPlatformTheme : public QObject, public QPlatformTheme {
// virtual QString standardButtonText(int button) const;
+public Q_SLOTS:
+ void lazyInit();
+
private:
void loadSettings();
private Q_SLOTS:
- void initWatch();
void onSettingsChanged();
private: