0

In the main.qml file, there's a SwipeView containing four pages. The second page hosts a smaller SwipeView with limited dimensions, containing four items. Beneath this sub SwipeView, there's a row of four buttons, each corresponding to one of the items. Users can either swipe through the items or use the buttons to navigate directly to a specific item.

Problem: The issue arises when the sub SwipeView reaches the last item on either side. At this point, the main SwipeView takes over and navigates to the next or previous page. Upon returning to the page containing the sub SwipeView, the swipe functionality continues to work properly. However, pressing the buttons no longer updates the displayed item, even though the currentIndex property changes accordingly. Strangely, the buttons start working when the sub view is swiped.

Second page having sub SwipeView

Item
{
    Rectangle
    {
        id: model
        anchors.fill: parent

        Column
        {
            id: col

            Rectangle
            {
                id: snap
                width: parent.width
                height: (parent.height/4)*3
                anchors.horizontalCenter: parent.horizontalCenter
                color: "#1f2633"

                AreaBorders
                {
            //Custom borders
                    id: borders

                    SwipeView
                    {
                        id: swipeView
                        width: parent.width
                        height: parent.height
                        spacing: 50
                        focus: true
                        currentIndex: 0

                        Item {
                            id: item1
                            Rectangle
                            {
                                anchors.fill: parent
                                color: "red"
                            }
                        }
                        Item {
                            id: item2
                            Rectangle
                            {
                                anchors.fill: parent
                                color: "blue"
                            }
                        }
                        Item {
                            id: item3
                            Rectangle
                            {
                                anchors.fill: parent
                                color: "green"
                            }
                        }
                        Item {
                            id: item4
                            Rectangle
                            {
                                anchors.fill: parent
                                color: "cyan"
                            }
                    }

                }
            }
            Row
            {
                id: row

                Rectangle
                {               
                    MouseArea
                    {
                        anchors.fill: parent
                        onPressed: swipeView.currentIndex=0
                    }
                }
                Rectangle
                {      
                    MouseArea
                    {
                        anchors.fill: parent
                        onPressed: swipeView.currentIndex=1
                    }
                }
                Rectangle
                {
                    MouseArea
                    {
                        anchors.fill: parent
                        onPressed: swipeView.currentIndex=2
                    }
                }
                Rectangle
                {
                    MouseArea
                    {
                        anchors.fill: parent
                        onPressed: swipeView.currentIndex=3
                    }
                }
            }
        }
    }
}

Note: This problem occurs in Android Emulator, Android Emulator v34.1.19 Android environment details: x86_64 architecture, Android 13.0, JDK v17, NDK v25.1.8937393

Running on Desktop kit presents no such issue.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.