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

ListView: call method onComplete

$
0
0
Hey there, I have a problem and it seems to be a Qt bug ^^ I have a Loader loading some qml. one of them is a MusicList. This music list has a ListView ListView{         id:listView         x:140         y:37         width:474         height:100         interactive: false         model: XmlListModel{             id:musicListModel               source: "xml/musicData.xml"             query: "/PLAYLIST/SONG"               XmlRole{ name:"TITLE"; query:"TITLE/string()" }         }         spacing:33         delegate:TrackItem{             trackID: index+1             title: TITLE         }           Component.onCompleted: {             initialize();         }     } When the component (listView) is completed I would like to call initialize() function initialize()     {         console.log("init");         listView.positionViewAtIndex(3, ListView.Beginning);     } While running I can see the output “init” but the positioning for the listview doesnt work although I followed these instructions Note: methods should only be called after the Component has completed. To position the view at startup, this method should be called by Component.onCompleted. For example, to position the view at the end: Component.onCompleted: positionViewAtIndex(count – 1, ListView.Beginning) Later while running changing the listViews position dynamically works pretty well. So any ideas whats happening?

Viewing all articles
Browse latest Browse all 4972

Trending Articles