Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Pathview, no way to detect that animation in progress



  • Hi all,
    I need to bind some logic to PathView animation. The problem is, there's no property for this.
    Consider the next code:

    import QtQuick 2.12
    import QtQuick.Window 2.12
    
    Window {
        visible: true
        width: 640
        height: 480
        PathView {
            id: _view
            anchors.fill: parent
            model: ListModel {
                id: _myList
                ListElement { qwe: "red" }
                ListElement { qwe: "green" }
                ListElement { qwe: "blue" }
            }
            delegate: Rectangle {
                width: 100;
                height: 50;
                color: qwe
                border.width: PathView.isCurrentItem ? 3 : 0
            }
            onMovingChanged: {
                console.log("moving: " + moving)
            }
            onFlickingChanged: {
                console.log("flicking: " + flicking)
            }
    
            path: Path {
                startX: 120; startY: 100
                PathQuad { x: 120; y: 25; controlX: 260; controlY: 75 }
                PathQuad { x: 120; y: 100; controlX: -20; controlY: 75 }
            }
        }
    
        Timer {
            interval: 3000;
            repeat: true
            running: true
            onTriggered: {
                _view.incrementCurrentIndex();
            }
        }
    }
    
    

    incrementCurrentIndex or direct assignment to currentIndex any value doesn't lead any indication that view actually in motion.
    Could you help to catch the end of animation? onMovingChanged and onFlickingChanged doesn't help.


Log in to reply