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

Invalid property assignment: unknown enumeration

XMLWordPrintable

      Can not assign an int to an enum property even though the enum maps exactly to that int. In this case ShaderEffectSource.ClampToEdge maps to 0 as the output shows.

      qrc:/qt/qml/untitled12/Main.qml:10:25: Invalid property assignment: unknown enumeration
      
      import QtQuick
      
      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          Item {
              layer.wrapMode: 0 // ShaderEffectSource.ClampToEdge
              Component.onCompleted: console.log(ShaderEffectSource.ClampToEdge)
          }
      }
      

      When using an additional property as shown in the example below it works with integers.

      import QtQuick
      
      Window {
          id: root
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          property int test: 1 // Qt.LeftButton
      
          MouseArea {
              acceptedButtons: root.test
              Component.onCompleted: console.log(Qt.LeftButton)
          }
      }
      

      This isn't fixed with QTBUG-121710 I've tested it with Qt 6.5.6 with the same outcome.

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

            qtqmlteam Qt Qml Team User
            henning Henning Gründl
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes