qml TreeView只响应鼠标左键的按键事件,可通过MouseArea捕捉鼠标右键动作,进行响应
TreeView
{
id
: view
MouseArea
{
anchors
.fill
: parent
acceptedButtons
: Qt
.RightButton
onClicked
: {
console
.log("onClicked right", view
.indexAt(mouseX
, mouseY
))
view
.__listView
.currentIndex
= view
.__listView
.indexAt(mouseX
, mouseY
)
}
}
}
转载请注明原文地址:https://tech.qufami.com/read-18059.html