forked from qt-creator/qt-creator
QmlDesigner: Fix button tooltip blocking event
Fix HelperWidgets AbstractButton nested TooplTipArea blocking hover events from the actual control. Task-number: QDS-4828 Change-Id: Ibd390c98805a49f903663b6c38091f727c2b7ec9 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
committed by
Henning Gründl
parent
0408b4a757
commit
d3b6777d12
@@ -32,6 +32,8 @@ StudioControls.AbstractButton {
|
|||||||
|
|
||||||
property alias tooltip: toolTipArea.tooltip
|
property alias tooltip: toolTipArea.tooltip
|
||||||
|
|
||||||
|
hover: toolTipArea.containsMouse
|
||||||
|
|
||||||
ToolTipArea {
|
ToolTipArea {
|
||||||
id: toolTipArea
|
id: toolTipArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@@ -31,6 +31,7 @@ T.AbstractButton {
|
|||||||
id: myButton
|
id: myButton
|
||||||
|
|
||||||
property bool globalHover: false
|
property bool globalHover: false
|
||||||
|
property bool hover: myButton.hovered
|
||||||
|
|
||||||
property alias buttonIcon: buttonIcon.text
|
property alias buttonIcon: buttonIcon.text
|
||||||
property alias iconColor: buttonIcon.color
|
property alias iconColor: buttonIcon.color
|
||||||
@@ -51,7 +52,7 @@ T.AbstractButton {
|
|||||||
z: myButton.checked ? 10 : 3
|
z: myButton.checked ? 10 : 3
|
||||||
activeFocusOnTab: false
|
activeFocusOnTab: false
|
||||||
|
|
||||||
onHoveredChanged: {
|
onHoverChanged: {
|
||||||
if (parent !== undefined && parent.hoverCallback !== undefined && myButton.enabled)
|
if (parent !== undefined && parent.hoverCallback !== undefined && myButton.enabled)
|
||||||
parent.hoverCallback()
|
parent.hoverCallback()
|
||||||
}
|
}
|
||||||
@@ -119,7 +120,7 @@ T.AbstractButton {
|
|||||||
states: [
|
states: [
|
||||||
State {
|
State {
|
||||||
name: "default"
|
name: "default"
|
||||||
when: myButton.enabled && !myButton.globalHover && !myButton.hovered
|
when: myButton.enabled && !myButton.globalHover && !myButton.hover
|
||||||
&& !myButton.pressed && !myButton.checked
|
&& !myButton.pressed && !myButton.checked
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: buttonBackground
|
target: buttonBackground
|
||||||
@@ -132,7 +133,7 @@ T.AbstractButton {
|
|||||||
},
|
},
|
||||||
State {
|
State {
|
||||||
name: "globalHover"
|
name: "globalHover"
|
||||||
when: myButton.globalHover && !myButton.hovered && !myButton.pressed && myButton.enabled
|
when: myButton.globalHover && !myButton.hover && !myButton.pressed && myButton.enabled
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: buttonBackground
|
target: buttonBackground
|
||||||
color: StudioTheme.Values.themeControlBackgroundGlobalHover
|
color: StudioTheme.Values.themeControlBackgroundGlobalHover
|
||||||
@@ -140,7 +141,7 @@ T.AbstractButton {
|
|||||||
},
|
},
|
||||||
State {
|
State {
|
||||||
name: "hover"
|
name: "hover"
|
||||||
when: myButton.hovered && !myButton.pressed && myButton.enabled
|
when: myButton.hover && !myButton.pressed && myButton.enabled
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: buttonBackground
|
target: buttonBackground
|
||||||
color: StudioTheme.Values.themeControlBackgroundHover
|
color: StudioTheme.Values.themeControlBackgroundHover
|
||||||
@@ -148,7 +149,7 @@ T.AbstractButton {
|
|||||||
},
|
},
|
||||||
State {
|
State {
|
||||||
name: "press"
|
name: "press"
|
||||||
when: myButton.hovered && myButton.pressed
|
when: myButton.hover && myButton.pressed
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: buttonBackground
|
target: buttonBackground
|
||||||
color: StudioTheme.Values.themeControlBackgroundInteraction
|
color: StudioTheme.Values.themeControlBackgroundInteraction
|
||||||
|
@@ -56,8 +56,8 @@ Row {
|
|||||||
var hover = false
|
var hover = false
|
||||||
|
|
||||||
for (var i = 0; i < children.length; ++i) {
|
for (var i = 0; i < children.length; ++i) {
|
||||||
if (children[i].hovered !== undefined)
|
if (children[i].hover !== undefined)
|
||||||
hover = hover || children[i].hovered
|
hover = hover || children[i].hover
|
||||||
}
|
}
|
||||||
|
|
||||||
myButtonRow.childHover = hover
|
myButtonRow.childHover = hover
|
||||||
|
Reference in New Issue
Block a user