SplitView 项目内的 MouseArea 将鼠标事件从 Splitview 句柄中移走
MouseArea inside SplitView item takes mouse events away from Splitview handle
我正在使用 qt quick controls 2 SplitView
,似乎 SplitView
项中的任何 MouseArea
都将鼠标事件从 SplitView
句柄中移除。这意味着当手柄位于具有 MouseArea
的组件上方时,无法拖动手柄,例如Button
,在 SplitView
的项目中。
import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.13
Window {
width: 640
height: 480
visible: true
title: qsTr("Hello World")
SplitView {
id: splitView
anchors.fill: parent
handle: Rectangle {
id: handle
implicitWidth: 20
color: "red"
}
Page {
id: firstPage
Button {
id: button
implicitWidth: 100
implicitHeight: 50
text: "button"
}
}
Page {
id: secondPage
}
}
}
正常行为:
按钮阻止来自句柄的鼠标事件:
我尝试将 splitView
和 handle
的 z 值设置为大于 firstPage
和 button
的 z 值,但这没有用。
尝试将第一页和第二页的z值设置为-1,SplitView设置为1
Page {
id: firstPage
clip: true
Button {
id: button
implicitWidth: 100
implicitHeight: 50
text: "button"
}
}
您必须在页面上激活剪辑。
我在一个空的 projet 上测试它工作。:D 我想手柄栏下加载按钮的右侧仍然处于活动状态。 (如果有人确切知道为什么发表评论)
我正在使用 qt quick controls 2 SplitView
,似乎 SplitView
项中的任何 MouseArea
都将鼠标事件从 SplitView
句柄中移除。这意味着当手柄位于具有 MouseArea
的组件上方时,无法拖动手柄,例如Button
,在 SplitView
的项目中。
import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.13
Window {
width: 640
height: 480
visible: true
title: qsTr("Hello World")
SplitView {
id: splitView
anchors.fill: parent
handle: Rectangle {
id: handle
implicitWidth: 20
color: "red"
}
Page {
id: firstPage
Button {
id: button
implicitWidth: 100
implicitHeight: 50
text: "button"
}
}
Page {
id: secondPage
}
}
}
正常行为:
按钮阻止来自句柄的鼠标事件:
我尝试将 splitView
和 handle
的 z 值设置为大于 firstPage
和 button
的 z 值,但这没有用。
尝试将第一页和第二页的z值设置为-1,SplitView设置为1
Page {
id: firstPage
clip: true
Button {
id: button
implicitWidth: 100
implicitHeight: 50
text: "button"
}
}
您必须在页面上激活剪辑。 我在一个空的 projet 上测试它工作。:D 我想手柄栏下加载按钮的右侧仍然处于活动状态。 (如果有人确切知道为什么发表评论)