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

SwipeView issues or go PathView



  • Hello,

    In my application I can swipe through a few mainpages until it reaches the last one. I would like to be able to go back to the first page when I swipe beyond the last one. I've read some things about using a PageView but can't seem to figure it out. Anyone who can help me get started? Do I make a listModel or just add the pages fully in the PathView or something like that?

        SwipeView {
            id: swipeView
            objectName: "swipeView"
    
            currentIndex: 1
            anchors.fill: parent
    
            MainPage {
                objectName: "mainPage"
            }
            MainPage2 {
                objectName: "mainPage2"
            }
            MainPage3 {
                objectName: "mainPage3"
            }
            MainPage4 {
                objectName: "mainPage4"
            }
    //        MainPage5 {
    //            objectName: "mainPage5"
    //        }
    //        Item {
    //            objectName: "page 6"
    //        }
    
            onCurrentIndexChanged: {
                indicatorVisible = true;
                mainPages.state = currentItem.objectName
             }
        }
    
        PageIndicator {
            id: indicator
    
            count: swipeView.count
            currentIndex: swipeView.currentIndex
    
            anchors.top: swipeView.top
            anchors.horizontalCenter: parent.horizontalCenter
    
            delegate: Rectangle {
                implicitWidth: 8
                implicitHeight: 8
    
                radius: width / 2
                color: "white"
    
                opacity: index === swipeView.currentIndex ? 1.0 : 0.35
            }
        }
    

Log in to reply