Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.11.0, 6.0.0
Description
After discussing potential solutions to QTBUG-82678, we thought that using containmentMask to extend the interactive area of a SplitView handle could be a nice solution. However, it doesn't work:
import QtQuick import QtQuick.Controls ApplicationWindow { visible: true width: 640 height: 480 SplitView { id: control anchors.fill: parent orientation: Qt.Horizontal handle: Rectangle { implicitWidth: control.orientation === Qt.Horizontal ? 6 : control.width implicitHeight: control.orientation === Qt.Horizontal ? control.height : 6 color: SplitHandle.pressed ? control.palette.mid : (SplitHandle.hovered ? control.palette.midlight : control.palette.button) containmentMask: Item { x: control.orientation === Qt.Horizontal ? -width / 2 : 0 y: control.orientation === Qt.Horizontal ? 0 : -height / 2 width: control.orientation === Qt.Horizontal ? 30 : control.width height: control.orientation === Qt.Horizontal ? control.height : 30 } } Rectangle { implicitWidth: 200 SplitView.maximumWidth: 400 color: "lightblue" Label { text: "View 1" anchors.centerIn: parent } } Rectangle { id: centerItem SplitView.minimumWidth: 50 SplitView.fillWidth: true color: "lightgray" Label { text: "View 2" anchors.centerIn: parent } } Rectangle { implicitWidth: 200 color: "lightgreen" Label { text: "View 3" anchors.centerIn: parent } } } }
Simpler, Qt Quick-only example:
import QtQuick Window { id: window visible: true width: 640 height: 480 Rectangle { id: control width: 10 height: 100 color: tapHandler.pressed ? Qt.darker("#444") : (hoverHandler.hovered ? Qt.lighter("#444") : "#444") anchors.centerIn: parent TapHandler { id: tapHandler } HoverHandler { id: hoverHandler } containmentMask: Item { x: (control.width - width) / 2 width: 30 height: control.height } } Rectangle { color: "transparent" border.color: "darkorange" x: control.x + control.containmentMask.x y: control.y + control.containmentMask.y width: control.containmentMask.width height: control.containmentMask.height } }
The position of the containmentMask does not seem to be taken into account; it is always positioned at {0, 0}.
Fixing this should be behaviourally compatible.
Attachments
Issue Links
- is required for
-
QTBUG-82678 Make SplitView use the touch area for hit testing
-
- Closed
-
- resulted from
-
QTBUG-82678 Make SplitView use the touch area for hit testing
-
- Closed
-