aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2021-12-08 18:06:35 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2021-12-09 23:16:36 +0100
commit2b50181be816094325adef6e9610b8dd9a03d6a8 (patch)
treecb4d454938fcf925088d62985de4e7b61507b65a /examples
parent93bdedc1557fe9681a64b9be409bd92e702d54aa (diff)
Add HoverHandler.blocking property
As with WheelHandler, sometimes users want to let the hover events propagate (which has been the default all along), but sometimes it's not appropriate to allow parents of nested items to show hover feedback. [ChangeLog][QtQuick][HoverHandler] HoverHandler now has a property called blocking, which is false by default; but if set to true, it prevents hover events from propagating to items "under" this handler's parent, and their HoverHandlers. Task-number: QTBUG-85926 Change-Id: I26f89482e294c7a6b30a55a7e23ac444a0d1ac7f Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/quick/pointerhandlers/sidebar.qml26
1 files changed, 21 insertions, 5 deletions
diff --git a/examples/quick/pointerhandlers/sidebar.qml b/examples/quick/pointerhandlers/sidebar.qml
index 7406931b28..29727b5684 100644
--- a/examples/quick/pointerhandlers/sidebar.qml
+++ b/examples/quick/pointerhandlers/sidebar.qml
@@ -55,7 +55,7 @@ Rectangle {
id: root
width: 640
height: 480
- color: "#444"
+ color: rootHover.hovered ? "#555" : "#444"
Component {
id: buttonsAndStuff
@@ -64,6 +64,11 @@ Rectangle {
anchors.margins: 8
spacing: 8
+ CheckBox {
+ id: hoverBlockingCB
+ text: "Button hover is blocking"
+ }
+
Rectangle {
objectName: "buttonWithMA"
width: parent.width
@@ -98,6 +103,7 @@ Rectangle {
id: buttonHH
objectName: "buttonHH"
acceptedDevices: PointerDevice.AllDevices
+ blocking: hoverBlockingCB.checked
cursorShape: tapHandler.pressed ? Qt.BusyCursor : Qt.PointingHandCursor
}
@@ -152,9 +158,9 @@ Rectangle {
objectName: "topSidebar"
radius: 5
antialiasing: true
- x: -radius
+ x: -10
y: -radius
- width: 120
+ width: 200
height: 200
border.color: topSidebarHH.hovered ? "cyan" : "black"
color: "#777"
@@ -181,16 +187,21 @@ Rectangle {
sourceComponent: buttonsAndStuff
anchors.fill: parent
}
+
+ Text {
+ anchors { left: parent.left; bottom: parent.bottom; margins: 12 }
+ text: "Hover Handler"
+ }
}
Rectangle {
objectName: "bottomSidebar"
radius: 5
antialiasing: true
- x: -radius
+ x: -10
anchors.bottom: parent.bottom
anchors.bottomMargin: -radius
- width: 120
+ width: 200
height: 200
border.color: bottomSidebarMA.containsMouse ? "cyan" : "black"
color: "#777"
@@ -208,6 +219,11 @@ Rectangle {
sourceComponent: buttonsAndStuff
anchors.fill: parent
}
+
+ Text {
+ anchors { left: parent.left; bottom: parent.bottom; margins: 12 }
+ text: "MouseArea"
+ }
}
HoverHandler {