From aa39bb192fed347a166e0b51c0c36c730f898ae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 2 Dec 2013 11:26:37 +0100 Subject: [PATCH] Connect changed from QML to the C++ side Connected in the view and further emited as a signal our KCM connects to. --- kcmkwin/kwincompositing/main.cpp | 3 +++ kcmkwin/kwincompositing/model.cpp | 2 ++ kcmkwin/kwincompositing/model.h | 2 ++ 3 files changed, 7 insertions(+) diff --git a/kcmkwin/kwincompositing/main.cpp b/kcmkwin/kwincompositing/main.cpp index 2bd2b58d5c..0df802446a 100644 --- a/kcmkwin/kwincompositing/main.cpp +++ b/kcmkwin/kwincompositing/main.cpp @@ -55,6 +55,9 @@ KWinCompositingKCM::KWinCompositingKCM(QWidget* parent, const QVariantList& args setLayout(vl); m_view->setWidth(width()); m_view->setHeight(height()); + connect(m_view.data(), &KWin::Compositing::EffectView::changed, [this]{ + emit changed(true); + }); } KWinCompositingKCM::~KWinCompositingKCM() diff --git a/kcmkwin/kwincompositing/model.cpp b/kcmkwin/kwincompositing/model.cpp index be2f52d61b..2aa757f201 100644 --- a/kcmkwin/kwincompositing/model.cpp +++ b/kcmkwin/kwincompositing/model.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include namespace KWin { @@ -371,6 +372,7 @@ void EffectView::init() setResizeMode(QQuickView::SizeRootObjectToView); rootContext()->setContextProperty("engine", this); setSource(QUrl(mainFile)); + connect(rootObject(), SIGNAL(changed()), this, SIGNAL(changed())); } }//end namespace Compositing diff --git a/kcmkwin/kwincompositing/model.h b/kcmkwin/kwincompositing/model.h index 78426953fe..18ebfeb4c0 100644 --- a/kcmkwin/kwincompositing/model.h +++ b/kcmkwin/kwincompositing/model.h @@ -103,6 +103,8 @@ public: Q_INVOKABLE QColor backgroundViewColor() { return KColorScheme(QPalette::Active, KColorScheme::Window, KSharedConfigPtr(0)).background(KColorScheme::NormalBackground).color(); }; +Q_SIGNALS: + void changed(); };