SwipeView inside a page child of Main SwipeView app
-
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
-
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