Rus*_*Sk. 6 qt qml qtquick2 qtquickcontrols2
如何防止页面手动刷入SwipeView
?我想通过与按钮的交互来刷新当前索引.我怎样才能做到这一点?这是我的QML代码:
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
import QtQuick.Window 2.2
import QtQuick.Controls.Material 2.0
ApplicationWindow {
property int globalForJs: 10;
id: mainWindow
visible: true
width: 1024
height: 768
color: '#ffffff'
signal qmlSignal(string msg)
TopPanel {
id: topPanel1
}
SwipeView {
id: view
currentIndex: 0
anchors.fill: parent
Rectangle {
id: firstPage
color: "red"
}
Rectangle {
id: secondPage
color: "blue"
}
}
BottomPanel {
id: bottomPanel1
}
}
Run Code Online (Sandbox Code Playgroud)
Mit*_*tch 11
最近添加了一个interactive
属性,将在Qt 5.8 alpha中提供.
如果你不能使用5.8,并且你知道它的类型contentItem
是a Flickable
(它目前适用于所有内置样式),你可以将其interactive
属性设置为false
:
Component.onCompleted: contentItem.interactive = false
Run Code Online (Sandbox Code Playgroud)