ListView: Change anchor onCurrentIndexChanged



  • hello,

    I wanna change the anchor of my ListView for a specifique Index value.
    But when "anchors.top" is change the currentIndex is "reset" to the last value.

    For exemple:

            onCurrentIndexChanged: {
                console.log("currentIndex : " + currentIndex);
                if (currentIndex == 0)
                    anchors.top = banner.bottom
                else
                    anchors.top = image.bottom
            }
    

    Runtime output:

    //current currentIndex = 2
    //set currentIndex = 0 from qml
    currentIndex :  0
    currentIndex :  2
    

    it look like anchor.top reset the currentIndex ?
    Is there any better way to change the anchor when index is changed ?

    Thanks in advance


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.