Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. update QML data
Forum Updated to NodeBB v4.3 + New Features

update QML data

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 3 Posters 468 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hanna
    wrote on last edited by Hanna
    #1

    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"; }
           }
    
    1 Reply Last reply
    0
    • Y Offline
      Y Offline
      Yaswanth
      wrote on last edited by
      #2

      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.

      H 1 Reply Last reply
      1
      • Y Yaswanth

        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.

        H Offline
        H Offline
        Hanna
        wrote on last edited by
        #3

        @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

        S 1 Reply Last reply
        0
        • H Hanna

          @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

          S Offline
          S Offline
          sonicss
          wrote on last edited by
          #4

          @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.

          H 1 Reply Last reply
          0
          • S sonicss

            @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.

            H Offline
            H Offline
            Hanna
            wrote on last edited by
            #5

            @sonicss @Yaswanth
            Can you have a look at my question at StackOverFlow
            https://stackoverflow.com/questions/62714390/integration-of-exposed-model-into-listmodel-qml

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved