problem with assigning a model to a combobox [answered]
i am trying to populate combobox with an list according to qt doc: http://doc.qt.io/qt-5/qml-qtquick-controls-combobox.html
it seems pretty simple:
ComboBox {
currentIndex: 2
**model**: ListModel {
id: cbItems
ListElement { text: "Banana"; color: "Yellow" }
ListElement { text: "Apple"; color: "Green" }
ListElement { text: "Coconut"; color: "Brown" }
}
width: 200
onCurrentIndexChanged: {
console.debug(cbItems.get(currentIndex).text + ", " + cbItems.get(currentIndex).color)
}
}
however when i do try that i get this at run time: Cannot assign to non-existent property "model" and a M16 error in editor
any idea how to solve that ? i am using these imports
import QtQuick 2.2 import Sailfish.Silica 1.0
Thanks !
please learn how to format text when posting code :)
Spam Hunter ( 2018-11-06 11:12:20 +0300 )editthanks for sharing..
cleanlabpos77 ( 2018-11-06 11:36:12 +0300 )edit