Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.15.1
-
-
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