aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlboundsignal.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2020-03-24 21:03:05 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2020-04-03 07:04:26 +0200
commit36fc392147ea79bb665058ea165c86f6cd6680d7 (patch)
treed95cb07098a6bf41111ea95b96c5a0fc65eba6a4 /src/qml/qml/qqmlboundsignal.cpp
parente40098c5303e7af4b12c64093b120405c63fdf8d (diff)
Implement support for property observers
Syntactically we call them signal handler expressions :-), now also working when the underlying property doesn't emit an old-style signal but is just a QProperty. Change-Id: I719a3e428f44af0fd48036434aefa682a02f7de1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlboundsignal.cpp')
-rw-r--r--src/qml/qml/qqmlboundsignal.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp
index 6272979e92..d47b4aa5a2 100644
--- a/src/qml/qml/qqmlboundsignal.cpp
+++ b/src/qml/qml/qqmlboundsignal.cpp
@@ -408,4 +408,13 @@ QQmlBoundSignalExpressionPointer &QQmlBoundSignalExpressionPointer::take(QQmlBou
return *this;
}
+QQmlPropertyObserver::QQmlPropertyObserver(QQmlBoundSignalExpression *expr)
+ : QPropertyObserver([](QPropertyObserver *self) {
+ auto This = static_cast<QQmlPropertyObserver*>(self);
+ This->expression->evaluate(QList<QVariant>());
+ })
+{
+ expression.take(expr);
+}
+
QT_END_NAMESPACE