Important: Please read the Qt Code of Conduct -

Problems of QAbstractListModel

  • Hello. I have some text files in several directories. Depends on selecting directory names from Combobox in QML, it displays values from the text file. I think that a good way is using QAbstractListModel. For each text file in a different directory, I've also created a class that is inherited from QObject, which contains a structure that stores different values. But, as I understood, the structure cannot be pass through QML. How to do that?




    I have also watched the ToDo-List example posted on YouTube from Qt.

  • Moderators

    QML support QAbstractItemModel instances.
    For this to fully support you need to implement roleNames() method in your model and map context variable names to your item roles.

    See this example.

Log in to reply