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

[REG 6.5.3 - 6.6.1] QML warning "Final member modelData is overridden in class QQmlDMAbstractItemModelData. The override won't be used."

    XMLWordPrintable

Details

    • All
    • 72c8d39da (dev), c12a90d3e (6.7), 2f57794e5 (6.6), 7b4221002 (dev), ad2d5908f (6.7)

    Description

      Started to notice new Qt warning at application start after updating from Qt 6.5.3 to 6.6.1.

      Final member modelData is overridden in class QQmlDMAbstractItemModelData. The override won't be used.
      

      Here is simple reproducer ModelWarning.zip

      import QtQuick
      import ModelWarning
      
      Window {
          width: 640
          height: 480
          visible: true
      
          ListView {
              anchors.fill: parent
              model: TestModel {}
              delegate: Rectangle {
                  required property string modelData
      
                  width: ListView.view.width
                  height: 30
                  Text {
                      anchors.centerIn: parent
                      text: modelData
                  }
              }
          }
      }
      

      Pay attention on the custom C++ model - TestModel, which provides 2 roles to QML, and one of them is "modelData"

      QHash<int, QByteArray> TestModel::roleNames() const
      {
          return {
              { SomeRole1, "modelData" },
              { SomeRole2, "someRole" }
          };
      }
      

      Previously this was not a problem, but since Qt 6.6.x it provokes the warning.

      Attachments

        For Gerrit Dashboard: QTBUG-120499
        # Subject Branch Project Status CR V

        Activity

          People

            ulherman Ulf Hermann
            studiosus Vladimir Belyavsky
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes