Here is my code :
import QtQuick 1.0
ListModel {
property real firstValue: 2
property real secondValue: 3
property real thirdValue: 1
id: leftGrid
ListElement {
icon: "Images/1.png"
value: leftGrid.firstValue
}
ListElement {
icon: "2.png"
value: -1
}
ListElement {
icon: "3.png"
value: leftGrid.secondValue
}
ListElement {
icon: "4.png"
value: leftGrid.thirdValue
}
}
This gives me the error:
ListElement: cannot use script for property value
What should I do?
I had this problem as well. Consider adopting one of the solutions reported in here: https://bugreports.qt.io/browse/QTBUG-16289 according to your version of Qt as explained.
I personally prefer to implement the model in C++. Read this: http://cdumez.blogspot.com/2010/11/how-to-use-c-list-model-in-qml.html.