Connect changed from QML to the C++ side

Connected in the view and further emited as a signal our KCM
connects to.
This commit is contained in:
Martin Gräßlin 2013-12-02 11:26:37 +01:00
parent befb2b8e8a
commit aa39bb192f
3 changed files with 7 additions and 0 deletions

View file

@ -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()

View file

@ -39,6 +39,7 @@
#include <QString>
#include <QQmlEngine>
#include <QtQml>
#include <QQuickItem>
#include <QDebug>
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

View file

@ -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();
};