How to prevent page manual swiping in SwipeView
? I would like to swipe current index just by interaction with buttons. How can I achieve that? Here is my QML code:
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
}
}
An interactive
property was added recently, and will be available in the Qt 5.8 alpha.
If you can't use 5.8, and you know that the type of the contentItem
is a Flickable
(which it currently is for all built-in styles), you can set its interactive
property to false
:
Component.onCompleted: contentItem.interactive = false
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With