Unsolved update QML data
-
I am using this QML Surface3D example from QT.
All what I want is to read the ListModel data from .txt instead of Data.qml (I already parsed the data from the .txt and had it in QStringList
This is Data.qml ( I just need to give this value on runtime)import QtQuick 2.1 Item { property alias model: dataModel ListModel { id: dataModel ListElement{ longitude: "0"; latitude: "0"; height: "124"; } ListElement{ longitude: "0"; latitude: "1"; height: "125"; } ListElement{ longitude: "0"; latitude: "2"; height: "124"; } }
-
How are you notifying application to read from file? Is user clicks on a button to start reading from file?
If yes, on user click u can read from file and update your model.If reading from file has to be done by itself without user action, u have to run a separate thread to read from continuously for say every 10 sec.
-
@Yaswanth the problem is not in the signal.
I just want whenever I the app run to read from a specific text file then parse this text file and throw this data on the model .
What I did till now is that I got the data from the .txt and put it in QStringList -
@Hanna Did u use model/view to show the content of the file?
you can use beginResetModel() and endResetModel() to reset the modeldata in your view.
-
@sonicss @Yaswanth
Can you have a look at my question at StackOverFlow
https://stackoverflow.com/questions/62714390/integration-of-exposed-model-into-listmodel-qml