[SOLVED]binding from C++: value can not updated automatically
i implemented my own Object derived class and embeded it to qml context. Code as
class my_class : public QObject
Q_PROPERTY(QString vlist MEMBER vlist NOTIFY vlistch)
QQmlContext* ctx = engine->rootContext();
text:my_class_fm.vlist // value can not automatically updated, why?
when i changed the value of "vlist" into qml direcly, "text" property automatically updated.
But i changed vlist internally via called member function which change the value then "text" property
not updated automatically. i wonder why? is this a threading issue? is there another way to succeed?
Did you emit your @vlistch()@ signal when doing the internal change?
not. am i have to do it?
I must admit I'm not a big fan of the MEMBER decorator. You might be interested in my AUTO_PROPERTY macro. I wrote up my reasoning and links to the macro code in "this blog post":http://syncor.blogspot.com/2014/11/qt-auto-property.html. In addition to keeping your private implementation details private, it writes the notify signal for you.