From b8a702a8f7a9c4ebf8060680ae6c775f6ead2922 Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Thu, 9 Mar 2023 10:32:36 +0100 Subject: [PATCH] Fix QPropertyAlias::addNotifier QPropertyAlias might be deprecated, but using it should still not fail to compile. Fixes: QTBUG-111735 Change-Id: I486cddb424b60cd3e5c539e26afca3726e29bb09 Reviewed-by: Ivan Solovev (cherry picked from commit 17c9001a53a2377cc38bdf4b1982cab2dca94573) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/kernel/qproperty.h | 2 +- tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/corelib/kernel/qproperty.h b/src/corelib/kernel/qproperty.h index 297a3fe9740..be960552fd6 100644 --- a/src/corelib/kernel/qproperty.h +++ b/src/corelib/kernel/qproperty.h @@ -982,7 +982,7 @@ public: template QPropertyNotifier addNotifier(Functor f) { - return QBindable(aliasedProperty(), iface).notify(f); + return QBindable(aliasedProperty(), iface).addNotifier(f); } bool isValid() const diff --git a/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp b/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp index 29a55e58ae0..9e9aa981aaa 100644 --- a/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp +++ b/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp @@ -2290,7 +2290,10 @@ void tst_QProperty::qpropertyAlias() alias.setValue(42); QCOMPARE(i->value(), 42); QProperty j; + bool notifierCalled = false; + auto myNotifier = alias.addNotifier([&](){notifierCalled = true;}); i->setBinding([&]() -> int { return j; }); + QVERIFY(notifierCalled); j.setValue(42); QCOMPARE(alias.value(), 42); i.reset();