Binding: Accept local signal handlers again
Pick-to: 6.4 6.5 Fixes: QTBUG-110628 Change-Id: Ifc5023a3bfeb575df3102c3ea363903ebffa88ba Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
43114c9755
commit
5bcbd0a513
|
@ -757,7 +757,8 @@ void QQmlBindPrivate::decodeBinding(
|
|||
if (!immediateState)
|
||||
return;
|
||||
|
||||
QQmlProperty property(q, propertyName);
|
||||
QQmlProperty property = QQmlPropertyPrivate::create(
|
||||
q, propertyName, contextData, QQmlPropertyPrivate::InitFlag::AllowSignal);
|
||||
if (property.isValid()) {
|
||||
if (!immediateState->hasCreator()) {
|
||||
immediateState->setCompletePending(true);
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
import QtQml
|
||||
|
||||
Binding {
|
||||
property string input
|
||||
property string output
|
||||
onInputChanged: output = input
|
||||
}
|
|
@ -37,6 +37,7 @@ private slots:
|
|||
void bindNaNToInt();
|
||||
void intOverflow();
|
||||
void generalizedGroupedProperties();
|
||||
void localSignalHandler();
|
||||
|
||||
private:
|
||||
QQmlEngine engine;
|
||||
|
@ -581,6 +582,17 @@ void tst_qqmlbinding::generalizedGroupedProperties()
|
|||
QCOMPARE(rootAttached->objectName(), QString());
|
||||
}
|
||||
|
||||
void tst_qqmlbinding::localSignalHandler()
|
||||
{
|
||||
QQmlEngine e;
|
||||
QQmlComponent c(&e, testFileUrl("bindingWithHandler.qml"));
|
||||
QVERIFY2(c.isReady(), qPrintable(c.errorString()));
|
||||
QScopedPointer<QObject> o(c.create());
|
||||
QVERIFY(!o.isNull());
|
||||
o->setProperty("input", QStringLiteral("abc"));
|
||||
QCOMPARE(o->property("output").toString(), QStringLiteral("abc"));
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_qqmlbinding)
|
||||
|
||||
#include "tst_qqmlbinding.moc"
|
||||
|
|
Loading…
Reference in New Issue