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

How to set individual combo boxes currentindex?

$
0
0
Hello,I have some question about set the combobox currentindex. I write some code like this ListModel {id: author1} //data may append from other model   TableView {    model: author1    TableViewColumn{       role: “attribute”       title: “attribute”       width: 180       delegate:Rectangle {           ComboBox {           id:combo           model:author1           textRole: “attribute”           anchors.fill: parent            Component.onCompleted: {              var i               for(i=0;i<combo.count;i++)               combo.currentIndex=i               }            }       } } Can I control each combobox in Component.onCompleted? The code I wrote above can only set the last element to be currentindex. I want to set each combobox currentindex according to the order in Listmodel. i.e. the second combobox should set its currentindex to 1 (currentindex start from 0) Thanks!

Viewing all articles
Browse latest Browse all 4972

Trending Articles