Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Updating the Textfields on Changed ListModel



  • Hello,

    I got a QAbstractListModel filled with Objects (containing a single Client in a Network each) with different simple Properties (QString, int, bool).

    From this ListModel I create a TableView with only the Name and Connection Information for all Objects in the ListModel. On selecting one Item in the TableView a WebSocket connection to the selected Client is established and all Information about the Client is requested (the settings of the Client) and as returned is written to the selected Clients Properties.

    This works as aspected, But now I tried to fill an Informationen QML Page with the gathered Information about the selected Client in simple Text{} Blocks

    This Works well on all the base Properties collected on Creating the single Client-Objects, but all the more detailed Information the Model got later on requesting seem not to be updated even if the information in the Object in the model is now completely filled (checked with console.log, all Properties are correctly in the Client).

    I expect this behavior to happen because the QML is created before all Information is available but I didn't find a way to reload the informational QML Page.

    Is there a Way to reload the QML or does this have to be solved on another way?

    Edit: updating the TextBlocks with a Button works (setting all text Properties on Click new), I wonder if there is a more elegant way of setting the Text than a button or a Signal/Slot firing every time a single stat is changed



  • I created a Signal emitted on completing iterating through all the Properties (after the last possible change to Properties. That Signals triggers the Slot to Updating the Display.


Log in to reply