hotfix: unbreak "pointing hand" cursor
turns out we can indeed have only one MouseArea to handle both the cursor and intercepting the event in the "loading" state
This commit is contained in:
parent
f89b0a8c6f
commit
1381b1bd15
|
@ -27,12 +27,18 @@ Column {
|
||||||
text: "Look I'm a tooltip on a button!"
|
text: "Look I'm a tooltip on a button!"
|
||||||
}
|
}
|
||||||
onClicked: console.warn("Primary button clicked")
|
onClicked: console.warn("Primary button clicked")
|
||||||
|
onPressed: console.warn("Primary button pressed")
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusButton {
|
StatusButton {
|
||||||
text: "Button"
|
text: "Button"
|
||||||
enabled: false
|
enabled: false
|
||||||
type: StatusBaseButton.Type.Primary
|
type: StatusBaseButton.Type.Primary
|
||||||
|
|
||||||
|
StatusToolTip {
|
||||||
|
visible: parent.hovered
|
||||||
|
text: "Tooltip on a disabled button, should not be visible!"
|
||||||
|
}
|
||||||
onClicked: console.warn("Primary disabled button clicked, this should not happen !!!")
|
onClicked: console.warn("Primary disabled button clicked, this should not happen !!!")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,8 @@ Button {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
spacing: root.size === StatusBaseButton.Size.Large ? 6 : 4
|
||||||
|
|
||||||
icon.height: 24
|
icon.height: 24
|
||||||
icon.width: 24
|
icon.width: 24
|
||||||
|
|
||||||
|
@ -74,16 +76,10 @@ Button {
|
||||||
return !root.loading && (root.hovered || root.highlighted) ? hoverColor : normalColor;
|
return !root.loading && (root.hovered || root.highlighted) ? hoverColor : normalColor;
|
||||||
return disabledColor;
|
return disabledColor;
|
||||||
}
|
}
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
enabled: root.enabled
|
|
||||||
acceptedButtons: Qt.NoButton
|
|
||||||
cursorShape: root.loading ? Qt.ArrowCursor : Qt.PointingHandCursor
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
contentItem: RowLayout {
|
contentItem: RowLayout {
|
||||||
spacing: root.size === StatusBaseButton.Size.Large ? 6 : 4
|
spacing: root.spacing
|
||||||
StatusIcon {
|
StatusIcon {
|
||||||
Layout.preferredWidth: visible ? root.icon.width : 0
|
Layout.preferredWidth: visible ? root.icon.width : 0
|
||||||
Layout.preferredHeight: visible ? root.icon.height : 0
|
Layout.preferredHeight: visible ? root.icon.height : 0
|
||||||
|
@ -123,8 +119,8 @@ Button {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
acceptedButtons: Qt.AllButtons
|
acceptedButtons: Qt.AllButtons
|
||||||
enabled: root.loading
|
enabled: root.loading
|
||||||
hoverEnabled: enabled
|
|
||||||
onPressed: mouse.accepted = true
|
onPressed: mouse.accepted = true
|
||||||
onWheel: wheel.accepted = true
|
onWheel: wheel.accepted = true
|
||||||
|
cursorShape: !root.loading ? Qt.PointingHandCursor: undefined // always works; 'undefined' resets to default cursor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue