2020-06-19 12:59:40 +02:00
|
|
|
From 9ea169167bb792b5128e707dbb76e4f659dc22e2 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Wolfgang Bauer <wbauer@tmo.at>
|
|
|
|
Date: Tue, 9 Jun 2020 08:27:30 +0200
|
|
|
|
Subject: [PATCH] Revert "Watch for language change events, and forward those
|
|
|
|
to the QML engine"
|
|
|
|
|
|
|
|
This reverts commit 9b7cae898ed7d9b58e65035b8216ec6ff78bfa17.
|
|
|
|
It causes several KCMs to crash, with Qt 5.12 at least.
|
|
|
|
|
|
|
|
References: boo#1167690, kde#419008
|
|
|
|
---
|
|
|
|
src/kirigamiplugin.cpp | 33 ---------------------------------
|
|
|
|
src/kirigamiplugin.h | 5 -----
|
|
|
|
2 files changed, 38 deletions(-)
|
|
|
|
|
2021-02-13 14:03:46 +01:00
|
|
|
Index: kirigami2-5.56.0git.20210118T122536~4ea74c86/src/kirigamiplugin.cpp
|
|
|
|
===================================================================
|
|
|
|
--- kirigami2-5.56.0git.20210118T122536~4ea74c86.orig/src/kirigamiplugin.cpp 2021-01-18 11:25:36.000000000 +0100
|
|
|
|
+++ kirigami2-5.56.0git.20210118T122536~4ea74c86/src/kirigamiplugin.cpp 2021-01-19 09:48:47.310333643 +0100
|
|
|
|
@@ -51,33 +51,6 @@
|
2020-06-19 12:59:40 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
-// we can't do this in the plugin object directly, as that can live in a different thread
|
|
|
|
-// and event filters are only allowed in the same thread as the filtered object
|
|
|
|
-class LanguageChangeEventFilter : public QObject
|
|
|
|
-{
|
|
|
|
- Q_OBJECT
|
|
|
|
-public:
|
|
|
|
- bool eventFilter(QObject *receiver, QEvent *event) override
|
|
|
|
- {
|
|
|
|
- if (event->type() == QEvent::LanguageChange && receiver == QCoreApplication::instance()) {
|
2021-02-13 14:03:46 +01:00
|
|
|
- Q_EMIT languageChangeEvent();
|
2020-06-19 12:59:40 +02:00
|
|
|
- }
|
|
|
|
- return QObject::eventFilter(receiver, event);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-Q_SIGNALS:
|
|
|
|
- void languageChangeEvent();
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-KirigamiPlugin::KirigamiPlugin(QObject *parent)
|
|
|
|
- : QQmlExtensionPlugin(parent)
|
|
|
|
-{
|
|
|
|
- auto filter = new LanguageChangeEventFilter;
|
|
|
|
- filter->moveToThread(QCoreApplication::instance()->thread());
|
|
|
|
- QCoreApplication::instance()->installEventFilter(filter);
|
|
|
|
- connect(filter, &LanguageChangeEventFilter::languageChangeEvent, this, &KirigamiPlugin::languageChangeEvent);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
QUrl KirigamiPlugin::componentUrl(const QString &fileName) const
|
|
|
|
{
|
|
|
|
for (const QString &style : qAsConst(m_stylesFallbackChain)) {
|
2021-02-13 14:03:46 +01:00
|
|
|
@@ -279,10 +252,4 @@
|
2020-06-19 12:59:40 +02:00
|
|
|
qmlProtectModule(uri, 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
-void KirigamiPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
|
|
|
|
-{
|
|
|
|
- Q_UNUSED(uri);
|
|
|
|
- connect(this, &KirigamiPlugin::languageChangeEvent, engine, &QQmlEngine::retranslate);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
#include "kirigamiplugin.moc"
|
2021-02-13 14:03:46 +01:00
|
|
|
Index: kirigami2-5.56.0git.20210118T122536~4ea74c86/src/kirigamiplugin.h
|
|
|
|
===================================================================
|
|
|
|
--- kirigami2-5.56.0git.20210118T122536~4ea74c86.orig/src/kirigamiplugin.h 2021-01-18 11:25:36.000000000 +0100
|
|
|
|
+++ kirigami2-5.56.0git.20210118T122536~4ea74c86/src/kirigamiplugin.h 2021-01-19 09:48:47.310333643 +0100
|
|
|
|
@@ -24,9 +24,7 @@
|
2020-06-19 12:59:40 +02:00
|
|
|
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
|
|
|
|
|
|
|
|
public:
|
|
|
|
- KirigamiPlugin(QObject *parent = nullptr);
|
|
|
|
void registerTypes(const char *uri) override;
|
|
|
|
- void initializeEngine(QQmlEngine *engine, const char *uri) override;
|
|
|
|
|
|
|
|
#ifdef KIRIGAMI_BUILD_TYPE_STATIC
|
|
|
|
static KirigamiPlugin& getInstance()
|
2021-02-13 14:03:46 +01:00
|
|
|
@@ -46,9 +44,6 @@
|
2020-06-19 12:59:40 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
-Q_SIGNALS:
|
|
|
|
- void languageChangeEvent();
|
|
|
|
-
|
|
|
|
private:
|
|
|
|
QUrl componentUrl(const QString &fileName) const;
|
|
|
|
QString resolveFilePath(const QString &path) const
|