Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-93678

data() is not invokable in QQmlListModel

    XMLWordPrintable

Details

    Description

      ListModel(QQmlListModel) inherits QAbstractListModel, which inherits QAbstractItemModel.

      There are 'data()' methods in QQmlListModel and QAbstractItemModel to check the model data.

      But It is only invokable on QAbstractItemModel. The data() method has to be invokable on the child classes.

       

      qabstractitemmodel.h (QAbstractItemModel)

      Q_INVOKABLE virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const = 0;

      qqmllistmodel_p.h (QQmlListModel)

      QVariant data(const QModelIndex &index, int role) const override;
      

      The history was:

      1. QQmlListModel inherits QAbstractListModel:
        https://git.sailfishos.org/mer-core/qtdeclarative/commit/7daab8039abc32ab5be5706a08cb58905fe0e0b6#37c796b8276181620832233992e5e90b1af4c81d_81_79
      2. data() in QAbstractItemModel became Q_INVOKABLE:
        https://codereview.qt-project.org/c/qt/qtbase/+/107171
      3. It seems a mistake not to put an invokable in the child class.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              taehyun.kyong Taehyun Kyong (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes