How to implement page turner buttons in QML swipeview

Viewed 1233

I have to implement pages using QML component like Item (say Item 1, Item 2, Item 3) in SwipeView without using Repeaters and also implement page turners as shown below. The getPreviousPage Rectangle should move the view to turn to previous page similarly for getNextPage Rectangle.

import QtQuick 2.6
import QtQuick.Window 2.2
import QtQuick.Controls 2.0

Window {
  visible: true
  color:"black"
  width: 400+100
  height: 200

  Rectangle
  {
      id:getPreviousPage
      color:"red"
      x:0
      y:0
      width:50
      height:200
      MouseArea
      {
          anchors.fill:parent
          onClicked:
          {
              //turn to previous page
          }
      }
  }

  Rectangle
  {
      id:getNextPage
      color:"green"
      width:50
      x:450
      y:0
      height:200
      MouseArea
      {
          anchors.fill:parent
          onClicked:
          {
              //turn to next page
          }
      }
  }




  Pane {
      id: pane
      width: 400
      height: 200
      x:50
      y:0

      SwipeView {
          id: view
          currentIndex: 1
          anchors.fill: parent

          Repeater {
              model: 3

              Pane {
                  width: view.width
                  height: view.height

                  Column {
                      spacing: 40
                      width: parent.width

                      Label {
                          width: parent.width
                          wrapMode: Label.Wrap
                          horizontalAlignment: Qt.AlignHCenter
                          text: view.currentIndex
                      }


                  }
              }
          }
      }


  }
    }
1 Answers
Related