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

qmllint: Unexpected type for property "columnWidthProvider" expected function got function

    XMLWordPrintable

    Details

    • Commits:
      842fe4dd27 (qt/qtdeclarative/dev) 842fe4dd27 (qt/tqtc-qtdeclarative/dev)

      Description

      With current qqtdeclarative dev I got new warning that "function not function" for columnProvider.

      For code from here: https://doc.qt.io/qt-6/qml-qtquick-tableview.html#row-heights-and-column-widths

      import QtQuick
      
      TableView {
          id: tableView
      
          property var columnWidths: [100, 50, 80, 150]
          columnWidthProvider: function (column) { return columnWidths[column] }
      
          Timer {
              running: true
              interval: 2000
              onTriggered: {
                  tableView.columnWidths[2] = 150
                  tableView.forceLayout();
              }
          }
      }
      

      qmllint reports:

      Warning: Test.qml:7:26: Unexpected type for property "columnWidthProvider" expected function got function
          columnWidthProvider: function (column) { return columnWidths[column] }
                               ^^^^^^^^^
      

      After I reverted this commit:

      commit 50ce71ae72b9ca90c52f77aa5b3ba78d63da89ae
      Author: Maximilian Goldstein <max.goldstein@qt.io>
      Date:   Wed May 18 12:04:37 2022 +0200
      
          QmlLintQuickPlugin: Warn about unexpected property binding types
          
          Sometimes we use var or Item property types when we actually expect
          some very specific types. We warn about these at runtime, let's also
          warn in the linter.
          
          Task-number: QTBUG-102859
      

      buggy warning disappears.

        Attachments

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

          Activity

            People

            Assignee:
            max.goldstein Maximilian Goldstein
            Reporter:
            evgeniy_dushistov evgeniy_dushistov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes