Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

Populating qml combobox

$
0
0
Looking at the ComboBox behaviour, it gets filled through its “model” property by using a “ListModel”. Now when you define the “ListModel” in QML let’s say something like: ListModel {             id: cbItems             ListElement { text: "Banana"; color: "Yellow" }             ListElement { text: "Apple"; color: "Green" }             ListElement { text: "Coconut"; color: "Brown" } The ComboBox control will use the contents of the tag “text” to fill it’s elements to be displayed. So I would suppose that you will need to provide such a model through your C++ class, I don’t know maybe a Qt stringList or AbstractModel in C++ from where you could provide your data in the format required by the QML ComboBox control.

Viewing all articles
Browse latest Browse all 4972

Trending Articles