Reputation: 57
I have bunch of data that has to be displayed continuously on the GUI. I can actually achieve it by setting timer and assigning the new values to the displayed values but I do not want to do in that way. Is there any solution or practical way to do that?
Upvotes: 0
Views: 728
Reputation: 57
First, I defined the property and added the notifier called payloadChanged to the signals of my class.
Q_PROPERTY(QList<qreal> PayloadList READ getPayloadList NOTIFY payloadChanged)
Secondly,
qmlRegisterType<<YOUR_CLASS_NAME>>("sample1.sample2", 1, 0, "<QML_ITEM_NAME>");
Finally
QML_ITEM_NAME{
console.log("PROPERTY")
}
When I applied these steps my data is automatically updated without any timer stuff.
Upvotes: 0
Reputation: 304
I think you have two options to achieve that:
Q_PROPERTY
. That means create a get function and a signalQAbstractListModel
.
https://doc.qt.io/qt-5/qabstractlistmodel.html Then implementing the function data, index, ecc., you will have everything already done for the UI
Upvotes: 2
Reputation: 85
Have you tried using Q_Property? Notify Signal may work for your situation. You can find the documentation from here.
Upvotes: 1