ListView and onCurrentIndexChanged



  • Hi everyone. I have a ListView

    @ ListView{
    id:someListView
    anchors.fill: parent

        currentIndex: 0
        onCurrentIndexChanged: root.currentIndex = currentIndex
    
        orientation: Qt.Horizontal
        boundsBehavior: Flickable.DragOverBounds
        model: someModel
    
        highlightRangeMode: ListView.StrictlyEnforceRange
        snapMode: ListView.SnapOneItem
        highlightFollowsCurrentItem:true
    
    }@
    

    the index is changed when the second item is at half of the ListView screen. Can I make it change only when the second item is entirely visible to the screen??



  • You could only set root.currentIndex once the view has stopped moving:

    @ onCurrentIndexChanged: if (!moving) root.currentIndex = currentIndex
    onMovingChanged: if (!moving) root.currentIndex = currentIndex@


Log in to reply
 

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