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.
kwin/0005-kcmeffects-Do-not-use-...

67 lines
2.7 KiB

From 76cd1fdc3411142991096adf8da9d7e74536f671 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= <mgraesslin@kde.org>
Date: Wed, 21 Oct 2015 13:23:40 +0200
Subject: [PATCH 5/6] [kcmeffects] Do not use root context properties
Apparently it's not allowed to set root context properties multiple
times. If one goes to systemsettings, opens effects kcm, closes it
and opens it again it crashes due to setting a context property with
same name again.
This change eliminates the need for the context property by modifying
the property of the QML objects directly.
BUG: 354164
BUG: 351763
FIXED-IN: 5.4.3
REVIEW: 125737
---
kcmkwin/kwincompositing/model.cpp | 3 ++-
kcmkwin/kwincompositing/model.h | 2 --
kcmkwin/kwincompositing/qml/EffectView.qml | 1 -
3 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/kcmkwin/kwincompositing/model.cpp b/kcmkwin/kwincompositing/model.cpp
index 376a779..1caf693 100644
--- a/kcmkwin/kwincompositing/model.cpp
+++ b/kcmkwin/kwincompositing/model.cpp
@@ -609,8 +609,9 @@ void EffectView::init(ViewType type)
}
QString mainFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, path, QStandardPaths::LocateFile);
setResizeMode(QQuickView::SizeRootObjectToView);
- rootContext()->setContextProperty("engine", this);
setSource(QUrl(mainFile));
+ rootObject()->setProperty("color",
+ KColorScheme(QPalette::Active, KColorScheme::Window, KSharedConfigPtr(0)).background(KColorScheme::NormalBackground).color());
connect(rootObject(), SIGNAL(changed()), this, SIGNAL(changed()));
setMinimumSize(initialSize());
connect(rootObject(), SIGNAL(implicitWidthChanged()), this, SLOT(slotImplicitSizeChanged()));
diff --git a/kcmkwin/kwincompositing/model.h b/kcmkwin/kwincompositing/model.h
index a1b2693..5bdabec 100644
--- a/kcmkwin/kwincompositing/model.h
+++ b/kcmkwin/kwincompositing/model.h
@@ -126,8 +126,6 @@ public:
};
EffectView(ViewType type, QWindow *parent = 0);
- Q_INVOKABLE QColor backgroundViewColor() { return KColorScheme(QPalette::Active, KColorScheme::Window, KSharedConfigPtr(0)).background(KColorScheme::NormalBackground).color(); };
-
void save();
void load();
void defaults();
diff --git a/kcmkwin/kwincompositing/qml/EffectView.qml b/kcmkwin/kwincompositing/qml/EffectView.qml
index b8ab25c..ac26925 100644
--- a/kcmkwin/kwincompositing/qml/EffectView.qml
+++ b/kcmkwin/kwincompositing/qml/EffectView.qml
@@ -27,7 +27,6 @@ Rectangle {
signal changed
implicitWidth: col.implicitWidth
implicitHeight: col.implicitHeight
- color: engine.backgroundViewColor()
Component {
id: sectionHeading
--
1.9.3