I am very new to QML and fairly seasoned with C++. I have been trying to go through some QML examples to try and learn it.
I was playing around with the TumblerColumn control (from examples) and basically trying to set the model to set the year. it goes something like:
TumblerColumn {
id: yearColumn
width: characterMetrics.width * 4 + tumbler.delegateTextMargins
model: ListModel {
Component.onCompleted: {
for (var i = 2000; i < 2100; ++i) {
append({value: i.toString()});
}
}
}
onCurrentIndexChanged: tumblerDayColumn.updateModel()
}
Now, I made a change like:
TumblerColumn {
id: yearColumn
width: characterMetrics.width * 4 + tumbler.delegateTextMargins
property int startYear: 2000
property int endYear: 3000
model: ListModel {
Component.onCompleted: {
for (var i = startYear; i < endYear; ++i) {
append({value: i.toString()});
}
}
}
onCurrentIndexChanged: tumblerDayColumn.updateModel()
}
This returns an error:
ReferenceError: startYear is not defined
How can I define these readonly constant properties for such a QML element.