Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.1
-
None
Description
The following code should print "Hallo", but it does not:
#include <iostream> #include <QVariant> #include <QObject> #include <QProperty> class MyClass : public QObject{ Q_OBJECT public: Q_OBJECT_BINDABLE_PROPERTY(MyClass, QVariant, foo); }; class EagerClass : public QObject{ Q_OBJECT signals: void mysignal(); public: Q_OBJECT_BINDABLE_PROPERTY(EagerClass, QVariant, foo, &EagerClass::mysignal); }; int main(){ MyClass a; a.foo = 5; EagerClass follower; follower.foo.setBinding([&](){ return a.foo.value(); }); QObject::connect(&follower, &EagerClass::mysignal, [](){ std::cout << "Hallo" << std::endl; }); // uncomment this, then it works // follower.foo.value(); std::cout << "should say Hallo:" << std::endl; a.foo = 6; } #include "main.moc"