0
我有這樣的代碼:的GridView和鼠標區域內衝突
import QtQuick 2.0
import QtQuick.Window 2.0
Window {
visible: true
width: 500
height: 500
GridView {
id: grid
anchors.fill: parent
cellWidth: 30
cellHeight: 30
model: 120
delegate: Rectangle {
width: grid.cellWidth
height: grid.cellHeight
color: "grey"
}
MouseArea {
anchors.fill: parent
onPressed: console.info(">> PRESSED triggered")
onMouseXChanged: console.info(">> " + mouseX)
onReleased: console.info(">> RELEASED triggered")
preventStealing: true
propagateComposedEvents: true
}
}
}
當我握着鼠標按鈕並在MouseArea
觸發嚴格移動它沿X軸,所有的信號。但是,當鼠標也沿着Y軸向上或向下移動時,onMouseXChanged
和onReleased
信號不會觸發。看來GridView
攔截了MouseArea
的信號,從MouseArea
中竊取了他們。我如何讓他們一起工作:GridView
與MouseArea
裏面?
是的,這工作,但電網現在不是可滑動的 – Constantine
你沒有提到,作爲你的問題的要求。 – Mitch
好吧,我的錯。我編輯它。 – Constantine