相关文章推荐
魁梧的卤蛋  ·  linnux 3 - CanntBelieve ·  4 天前    · 
魁梧的卤蛋  ·  info.plist reference: ...·  9 月前    · 
魁梧的卤蛋  ·  [RESOLVED] Quick ...·  11 月前    · 
魁梧的卤蛋  ·  org.openqa.selenium.No ...·  1 年前    · 
魁梧的卤蛋  ·  Getting Started with ...·  1 年前    · 
魁梧的卤蛋  ·  Gradle failed to ...·  1 年前    · 
难过的打火机  ·  使用 If...Then...Else ...·  1小时前    · 
温文尔雅的生姜  ·  mssql sqlserver ...·  1小时前    · 
Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode . Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).

I am having some problems if i use swipe view and i have written following code:

import QtQuick 2.6
import QtQuick.Window 2.2
import QtQuick.Controls 2.2
Window {
    visible: true
    width: 640
    height: 480
    title: qsTr("Swipe View")
    MainForm {
        anchors.fill:parent
        Rectangle{
            id:rightRect
            anchors.right:parent.right
            width: parent.width*0.50
            height:parent.height
            color:"yellow"
        Rectangle{
            id:leftRect
            width:parent.width*0.50
            height:parent.height
            color:"lightgreen"
            border.color:"red"
            anchors.right:rightRect.left
            SwipeView{
                id:swipeView
                anchors.fill : leftRect
                //Layout.fillWidth: true
                currentIndex: 0
                interactive: false
                Page{
                    id:page1
                    Rectangle{
                        width:parent.width
                        height:parent.height
                        color:"lightgreen"
                        Button{
                            text:"move to 2"
                            onClicked: swipeView.currentIndex = 1
                Page{
                    id:page2
                    Rectangle{
                        width:parent.width
                        height:parent.height
                        color:"lightblue"
                        Button{
                            text:"move to 1"
                            onClicked: swipeView.currentIndex = 0

Below are the screen shots:

  • Initially i have set current index to "0" but index "1" blue area is visible and it's covering the right area(Yellow rectangle):
  • if I click on move to 2 button then the yellow rect is visible as expected.
  • Now, Even if I click on move to 1 button I need same behavior ie., yellow rect should be visible all the time.How to achieve this ??

     
    推荐文章