Not able to add a list property to QML element
-
This seems like valid QML to me
@Rectangle {
width: 360
height: 360Image { id: charsprite property list<string> frames: ["qrc:/chrsprite/walk1.png","qrc:/chrsprite/walk2.png"] property int frame: 1 height: 200 width: 100 source: frames[frame] } Timer { interval: 500 running: true repeat: true onTriggered: charsprite.frame = charsprite.frame+1 % 2 }
}@
But whenever I run the code, the QML parser gives the following error:
@...qml/MiniGame/main.qml:10:40: Expected a qualified name id
property list<string> frames: ["qrc:/chrsprite/walk1.png","qrc:/chrsprite/walk2.png"] @What am I doing wrong here in my declaration/initialization of the charsprite.frames property?
-
HI,
From memory currently only lists of object types (and not basic types like strings) are supported using the property list<type> syntax. You might want to check http://bugreports.qt.nokia.com to see if there is an existing suggestion for this, or add one if there isn't.
Regards,
Michael -
Yup, thats it. I guess the documentation does sneak that in (the word object is used, but its not specific about what sort of object). So the only thing i can see actually erroneous about the behavior is how and where the parser reports it. It should be reporting it in the LHS, since the type itself is malformed. Thanks Michael.