1
我有如果我使用滑动视图一些问题,我已经写以下代码:QML SwipeView涵盖整个窗口
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
}
}
}
}
}
}
}
下面是屏幕截图:
1)首先我已设定的电流指数“0”但指数“1”蓝色区域是可见的,它覆盖的右侧区域(黄色矩形):
2)如果我点击移动到2按钮然后黄色矩形如预期的那样可见。
现在,即使我点击招1按钮我需要相同的行为,即,黄色矩形应该是可见的所有time.How实现这一目标?
如果我添加剪辑它按预期工作,但有没有什么办法可以禁用过渡索引改变? – pra7
你指的是哪个索引? –
SwipeView - >当我设置这个** swipeView.currentIndex **有一些过渡/动画发生。 – pra7