Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/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?

    d2264718-e202-4691-9dfd-9f102c7cc4dc-image.png

    c24e40da-e656-4943-a42c-d79d364bb8b2-image.png

    a47f6513-76d2-4eb9-ae7b-47ed8ab27546-image.png

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


  • Moderators

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