aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlengine.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-10-23 09:50:53 +0200
committerUlf Hermann <ulf.hermann@qt.io>2020-10-23 14:08:28 +0200
commit797a8f2aaaa8133ea8a54d9e4b91ba531fab3070 (patch)
tree047eb128e093252ae120b64f2c4278088738857f /src/qml/qml/qqmlengine.cpp
parent1596dbf081ff52d3fe07fdccfd69ffdf1b28e92c (diff)
QQmlEngine: Add method to explicitly capture a property
Also, use that method to capture the uiLanguage notify signal. Previously the wrong signal was captured. The test still happened to pass because we manually re-evaluated all bindings when the uiLanguage property changed. Add a test which avoid that. Change-Id: I3961b60b365a8705930936f20881421bd4ceffe5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlengine.cpp')
-rw-r--r--src/qml/qml/qqmlengine.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index 3f871d5c6a..b5b36cccb9 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -1327,6 +1327,21 @@ void QQmlEngine::setOutputWarningsToStandardError(bool enabled)
}
/*!
+ \internal
+
+ Capture the given property as part of a binding.
+ */
+void QQmlEngine::captureProperty(QObject *object, const QMetaProperty &property) const
+{
+ Q_D(const QQmlEngine);
+ if (d->propertyCapture) {
+ d->propertyCapture->captureProperty(
+ object, property.propertyIndex(),
+ QMetaObjectPrivate::signalIndex(property.notifySignal()));
+ }
+}
+
+/*!
\qmlproperty string Qt::uiLanguage
\since 5.15