我正在使用SwipeView,我想阻止它在触摸屏上用一根手指在页面之间滑动。如何限制SwipeView只能用两个手指滑动?
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")
}
}
}发布于 2021-05-30 16:12:18
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;
}
}
}
}
}https://stackoverflow.com/questions/67682527
复制相似问题