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

ListElement: cannot use script for property value

    XMLWordPrintable

Details

    • All
    • cad5c89a0f (qt/qtdeclarative/dev) cad5c89a0f (qt/tqtc-qtdeclarative/dev) cbef5bae84 (qt/qtdeclarative/6.4) cbef5bae84 (qt/tqtc-qtdeclarative/6.4)

    Description

      It is impossible to use the enumerations in the model's ListElements, e.g. this code:

      import QtQuick 2.12
      import QtQuick.Window 2.12
      
      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          enum TextType {
              Normal,
              Heading
          }
      
          ListView {
              anchors.fill: parent
              width: 180; height: 200
              model: ListModel {
                  ListElement {
                      name: main.TextType.Normal
                  }
                  ListElement {
                      name: main.TextType.Heading
                  }
              }
      
              delegate: Text { text: name }
          }
      }
      

       causes the error:

      ```

      QQmlApplicationEngine failed to load component
      qrc:/main.qml:20:17: ListElement: cannot use script for property value

      ```

      that it is strange, tbecause the enums are integers: https://doc.qt.io/qt-5/qtqml-syntax-objectattributes.html#enumeration-attributes

       

      Attachments

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

        Activity

          People

            ulherman Ulf Hermann
            kuzulis Denis Shienkov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes