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

QQmlListProperty error on non-registered type is confusing

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • P3: Somewhat important
    • None
    • 5.8.0
    • None

    Description

      During some recent development, I made an error in exposing a class hierarchy to Qml. I essentially defined:

      class BaseFoo { }
      class MyFoo : public BaseFoo {}

      class Bar

      { Q_PROPERTY(QQmlListProperty<BaseFoo> foos READ foos) }

      In my startup code I did qmlRegisterType on Bar and MyFoo but forgot to do it on BaseFoo. The problem is, the reported error message upon parsing a QML file and trying to define 'foos' was:

      Test.qml:4 Invalid property assignment: \"foos\" is a read-only property\n

      While it's reasonable that the code failed, the error message is highly confusing.

      Attachments

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

        Activity

          People

            srutledg Shawn Rutledge
            zakalawe James Turner
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes