Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在这:
Q_PROPERTY(QString datastring READ showdata() NOTIFY datastringChanged)
信号是datastringChanged为了在 QML 端为属性分配新的东西时发出信号datastring,还是在 C++ 端需要通知 QML 端时发出信号showdata(),因为它已经更新了信息,所以应该再次检查?
datastringChanged
datastring
showdata()
后者。请注意,QML 无法设置该属性(即它在 QML 中是只读的),因为它缺少WRITE方法。
WRITE
(而且,吹毛求疵,它只是READ showdata,没有()。)
READ showdata
()