Important: Please read the Qt Code of Conduct -

Custom model of nested lists to QML

  • Hello,

    What's the best approach to creating a role that exposes a list in QML?

    There is a list of players and their bug reports. This is how the data is structured:

    • NameRole,
    • AgeRole,
    • CreatedDatetimeRole,
    • ChangedDatetimeRole,
    • ReportsRole: [
      • ReportNameRole,
      • ReportDescriptionRole,
      • ReportDateRole,
      • ReportId

    Originally I thought of a QAbstractListItem that returns a QAbstractListItem as a QObject-cast-to-QVariant role? It does not seem to fit the TreeItem/TreeModel example as the roles are different between parent/child.


  • Still not sure what's the best design here.