QML滑动查看双指滑动
我正在使用SwipeView,我想防止它在触摸屏上用一个手指在页面之间滑动。如何将SwipeView滑动限制为仅用两个手指滑动QML滑动查看双指滑动,qml,Qml,我正在使用SwipeView,我想防止它在触摸屏上用一个手指在页面之间滑动。如何将SwipeView滑动限制为仅用两个手指滑动 import QtQuick 2.9 import QtQuick.Controls 2.2 ApplicationWindow { visible: true width: 640 height: 480 title: qsTr("Tabs") SwipeView { id: swipeV
import QtQuick 2.9
import QtQuick.Controls 2.2
ApplicationWindow {
visible: true
width: 640
height: 480
title: qsTr("Tabs")
SwipeView {
id: swipeView
anchors.fill: parent
currentIndex: tabBar.currentIndex
Page1Form {
}
Page2Form {
}
}
footer: TabBar {
id: tabBar
currentIndex: swipeView.currentIndex
TabButton {
text: qsTr("Page 1")
}
TabButton {
text: qsTr("Page 2")
}
}
}
这段代码有什么问题?@folibis没有问题,我只想让这发生在两个手指上。从你的问题来看,什么工作不正确是完全不清楚的。我想,不要用一个手指刷卡
Page1Form {
MultiPointTouchArea {
anchors.fill: parent
mouseEnabled: false
minimumTouchPoints: 1
maximumTouchPoints: 10
onTouchUpdated:{
var pointId=[];
for (var touch in touchPoints){
pointId.push(touchPoints[touch].pointId);
//console.log(pointId);
if(pointId.length === 2){
swipeView.interactive = true;
}else{
swipeView.interactive = false;
}
}
}
}
}