Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. SwipeView inside a page child of Main SwipeView app
Qt 6.11 is out! See what's new in the release blog

SwipeView inside a page child of Main SwipeView app

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 585 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • gfxxG Offline
    gfxxG Offline
    gfxx
    wrote on last edited by
    #1

    I'm not able to run my swipeView that is contain in page6 of Main swipeView application .... So the situation is:
    *a main swipeView app with n pages (ui.qml)
    *in page6 (ui.qml) of main I try to insert an other swipeview (with id: swipeWiewChild) element, with 10 pages
    *in page6 I insert also tabBar for navigate inside swipeViewchild (ui.qml)

    The problem: not able to navigate inside swipeViewchild. the code that I use inside page6:

    import QtQuick 2.3
    import QtQuick.Controls 2.3
    import QtDataVisualization 1.3
    import QtQuick.LocalStorage 2.0
    import QtQuick.Window 2.10
    import QtSensors 5.9
    import Qt.labs.calendar 1.0
    import QtGraphicalEffects 1.0
    import QtQuick.Controls.Imagine 2.3
    import QtQuick.Extras 1.4
    import QtQuick.XmlListModel 2.0
    import QtQml.Models 2.1
    import QtCharts 2.0
    import QtQuick.Layouts 1.1
    
    
    Page {
        id: myPg6
        width: 1440
        height: 900
        property alias svipeViewDBCurrentIndex: svipeViewDB.currentIndex
        property alias tabBarDBCurrentIndex: tabBarDB.currentIndex
        property alias svipeViewDB: svipeViewDB
        property alias tabBarDB: tabBarDB
        Layout.fillWidth: true
        Layout.fillHeight: true
        Layout.preferredWidth: 1440
        Layout.preferredHeight: 900
        Layout.minimumWidth: 1440
        Layout.minimumHeight: 900
    
        Rectangle {
            id: page5Rect
            x: 0
            y: 0
            width: 1440
            height: 818
            Layout.fillWidth: true
            Layout.fillHeight: true
            Layout.preferredWidth: 1440
            Layout.preferredHeight: 840
            Layout.minimumWidth: 1440
            Layout.minimumHeight: 840
    
            color: "#ffffff"
    
            //property alias currentIndex: homeRoot.currentIndex
    
            BannerPg1 {
                id: bannerPg6
                Layout.fillWidth: true
            }
    
            Label {
                text: qsTr("You are on Page 6.")
                anchors.verticalCenterOffset: -383
                anchors.horizontalCenterOffset: 380
                anchors.centerIn: parent
            }
    
    
    
            Rectangle {
                id: sestoRoot
                x: 0
                y: 50
                width: 1440
                height: 790
                color: "#ffffff"
    
                TabBar {
                    id: tabBarDB
                    y: 5
                    width: 1200
                    height: 40
                    anchors.horizontalCenter: parent.horizontalCenter
                    currentIndex: svipeViewDB.currentIndex
                   // count: svipeViewDB.count
    
                    TabButton {
                        text: qsTr("you Are in New Page inside Swipe Page -matrioska swipe-  1")
                    }
                    TabButton {
                        text: qsTr("you Are in New Page inside Swipe Page -matrioska swipe-  2")
                    }
                    TabButton {
                        text: qsTr("you Are in New Page inside Swipe Page -matrioska swipe-  3")
                    }
                    TabButton {
                        text: qsTr("you Are in New Page inside Swipe Page -matrioska swipe-  4")
                    }
                    TabButton {
                        text: qsTr("you Are in New Page inside Swipe Page -matrioska swipe-  5")
                    }
                    TabButton {
                        text: qsTr("you Are in New Page inside Swipe Page -matrioska swipe-  6")
                    }
                    TabButton {
                        text: qsTr("you Are in New Page inside Swipe Page -matrioska swipe-  7")
                    }
                    TabButton {
                        text: qsTr("you Are in New Page inside Swipe Page -matrioska swipe-  8")
                    }
                    TabButton {
                        text: qsTr("you Are in New Page inside Swipe Page -matrioska swipe-  9")
                    }
                    TabButton {
                        text: qsTr("you Are in New Page inside Swipe Page -matrioska swipe-  10")
                    }
                }
    
                SwipeView {
                    id: swipeViewChild
                    y: 45
                    width: 1440
                    height: 745
                    visible: true
                    currentIndex: tabBarDB.currentIndex
    
                    MyDBpg1{
    
                    }
                    MyDBpg2{
    
                    }
                    MyDBpg3{
    
                    }
                    MyDBpg4{
    
                    }
                    MyDBpg5{
    
                    }
                    MyDBpg6{
    
                    }
                    MyDBpg7{
    
                    }
                    MyDBpg8{
    
                    }
                    MyDBpg9{
    
                    }
                    MyDBpg10{
    
                    }
                }
    
            }
    
    
        }
    }
    

    obviously I'm wrong, but I do not know what. First of all, is it allowed to do this?
    According to someone, I can tell where the error is.

    regards

    bkt

    1 Reply Last reply
    0
    • gfxxG Offline
      gfxxG Offline
      gfxx
      wrote on last edited by gfxx
      #2

      I reply I answer my question by myself: first of all it seems that the tabbar must always be positioned at the end of the "root" and must have a "footer" or "header" position. Without these specifications I was not able to get real errors ... or the pages inserted in the swipe had anchors to the layout and this is not allowed.

      Once I entered this code (scroll the code to the end):

      
      import QtQuick 2.3
      import QtQuick.Controls 2.3
      import QtDataVisualization 1.3
      import QtQuick.LocalStorage 2.0
      import QtQuick.Window 2.10
      import QtSensors 5.9
      import Qt.labs.calendar 1.0
      import QtGraphicalEffects 1.0
      import QtQuick.Controls.Imagine 2.3
      import QtQuick.Extras 1.4
      import QtQuick.XmlListModel 2.0
      import QtQml.Models 2.1
      import QtCharts 2.0
      import QtQuick.Layouts 1.1
      
      
      Page {
          id: myPg6
          width: 1440
          height: 900
          property alias svipeViewDBCurrentIndex: svipeViewDB.currentIndex
          property alias tabBarDBCurrentIndex: tabBarDB.currentIndex
          property alias svipeViewDB: svipeViewDB
          property alias tabBarDB: tabBarDB
          Layout.fillWidth: true
          Layout.fillHeight: true
          Layout.preferredWidth: 1440
          Layout.preferredHeight: 900
          Layout.minimumWidth: 1440
          Layout.minimumHeight: 900
      
          Rectangle {
              id: page5Rect
              x: 0
              y: 0
              width: 1440
              height: 818
              Layout.fillWidth: true
              Layout.fillHeight: true
              Layout.preferredWidth: 1440
              Layout.preferredHeight: 840
              Layout.minimumWidth: 1440
              Layout.minimumHeight: 840
      
              color: "#ffffff"
      
              //property alias currentIndex: homeRoot.currentIndex
      
              BannerPg1 {
                  id: bannerPg6
                  Layout.fillWidth: true
              }
      
              Label {
                  text: qsTr("You are on Page 6.")
                  anchors.verticalCenterOffset: -383
                  anchors.horizontalCenterOffset: 380
                  anchors.centerIn: parent
              }
      
      
      
              Rectangle {
                  id: sestoRoot
                  x: 0
                  y: 50
                  width: 1440
                  height: 790
                  color: "#ffffff"
      
      
                  SwipeView {
                      id: swipeViewChild
                      y: 45
                      width: 1440
                      height: 745
                      visible: true
                      currentIndex: tabBarDB.currentIndex
      
                      MyDBpg1{
      
                      }
                      MyDBpg2{
      
                      }
                      MyDBpg3{
      
                      }
                      MyDBpg4{
      
                      }
                      MyDBpg5{
      
                      }
                      MyDBpg6{
      
                      }
                      MyDBpg7{
      
                      }
                      MyDBpg8{
      
                      }
                      MyDBpg9{
      
                      }
                      MyDBpg10{
      
                      }
                  }
      
                  TabBar {                /*********   I've positioned TabBar at the end of code  *****************/
                      id: tabBarDB
                      y: 5
                      width: 1200
                      height: 40
                      anchors.horizontalCenter: parent.horizontalCenter
                      position: TabBar.Header         /*********   I've insert POSITION: TabBar.Header ... after these I can see the real error  *****************/
                      currentIndex: svipeViewDB.currentIndex
                     // count: svipeViewDB.count
      
                      TabButton {
                          text: qsTr("you Are in New Page inside Swipe Page -matrioska swipe-  1")
                      }
                      TabButton {
                          text: qsTr("you Are in New Page inside Swipe Page -matrioska swipe-  2")
                      }
                      TabButton {
                          text: qsTr("you Are in New Page inside Swipe Page -matrioska swipe-  3")
                      }
                      TabButton {
                          text: qsTr("you Are in New Page inside Swipe Page -matrioska swipe-  4")
                      }
                      TabButton {
                          text: qsTr("you Are in New Page inside Swipe Page -matrioska swipe-  5")
                      }
                      TabButton {
                          text: qsTr("you Are in New Page inside Swipe Page -matrioska swipe-  6")
                      }
                      TabButton {
                          text: qsTr("you Are in New Page inside Swipe Page -matrioska swipe-  7")
                      }
                      TabButton {
                          text: qsTr("you Are in New Page inside Swipe Page -matrioska swipe-  8")
                      }
                      TabButton {
                          text: qsTr("you Are in New Page inside Swipe Page -matrioska swipe-  9")
                      }
                      TabButton {
                          text: qsTr("you Are in New Page inside Swipe Page -matrioska swipe-  10")
                      }
                  }
      
              }
      
      
          }
      }
      
      

      I could see the errors reported by qt designer... anchors in layout of sub-pages.

      regards

      bkt

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved