[Qt-qml] ListView and positionViewAtIndex problem

ext-ari.t.koskenvaara at nokia.com ext-ari.t.koskenvaara at nokia.com
Wed Jan 5 08:05:21 CET 2011


Hi,

I'm trying to roll listview to show some item which dosen't seen at the start of the list. Qml help says that you can use Component.onCompleted where you can call positionViewAtIndex, but it seems not working.

Here is example code:

ListView {
    id: list
    height: parent.height
    delegate: listDelegate
    model: theModel
    clip: true
    boundsBehavior: "StopAtBounds"
    focus: true
    highlight: null
    Component.onCompleted: {
        positionViewAtIndex(9, ListView.End); //This is not working
        //timer.start(); //This is same thing with timer and this is working, but isn't nice solution.
        console.log("onCompeted");
    }
    /*Timer {
        id: timer
        interval: 1
        onTriggered: list.positionViewAtIndex(9, ListView.End);
    }*/
    //onFocusChanged: positionViewAtIndex(9, ListView.End); // This is working, but isn't nice solution.
    //onHeightChanged: positionViewAtIndex(9, ListView.End); // This is working, but isn't nice solution.

Does anyone seen some kind of problem and know some good solution to it?

Regards
Ari Koskenvaara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20110105/3fba08f1/attachment.html 


More information about the Qt-qml mailing list