2016-11-16 18 views
4

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 
    }  
} 

答えて

10

interactiveプロパティwas added recentlyは、とQt 5.8アルファで利用できるようになります。

あなたが5.8を使用できない場合、あなたはcontentItemのタイプはFlickableであることを知っている(それは現在、すべての組み込みのスタイルのためである)、あなたはfalseにそのinteractiveプロパティを設定することができます。

Component.onCompleted: contentItem.interactive = false 
関連する問題