Fix QPropertyAlias::addNotifier

QPropertyAlias might be deprecated, but using it should still not fail
to compile.

Pick-to: 6.5
Fixes: QTBUG-111735
Change-Id: I486cddb424b60cd3e5c539e26afca3726e29bb09
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit is contained in:
Fabian Kosmale 2023-03-09 10:32:36 +01:00
parent bbb9cf225f
commit 17c9001a53
2 changed files with 4 additions and 1 deletions

View File

@ -999,7 +999,7 @@ public:
template<typename Functor>
QPropertyNotifier addNotifier(Functor f)
{
return QBindable<T>(aliasedProperty(), iface).notify(f);
return QBindable<T>(aliasedProperty(), iface).addNotifier(f);
}
bool isValid() const

View File

@ -2296,7 +2296,10 @@ void tst_QProperty::qpropertyAlias()
alias.setValue(42);
QCOMPARE(i->value(), 42);
QProperty<int> 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();