File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515
1616import QtQuick 2.15
1717import QtQuick.Controls 2.15
18+ import QtQuick.Controls.Universal 2.15
1819
1920// Qt's own AbstractButton press/release detection intermittently drops clicks on some Qt 6.10
2021// installs while the audio engine is running; a plain MouseArea's simpler grab never does, which is
@@ -23,8 +24,30 @@ import QtQuick.Controls 2.15
2324// press before Button's own handling ever sees it, so this never double-fires.
2425Button {
2526 id: root
27+ // Since the overlay eats the press before Button's own handling ever sees it, `pressed` (and so
28+ // the default `down`) never goes true on its own -- rebinding `down` to the overlay's own pressed
29+ // state is what gets the style's normal pressed-color feedback back. `hovered` has no equivalent
30+ // override (it is read-only), so the background below reads the overlay's containsMouse directly
31+ // instead of relying on the Control's own -- apparently also overlay-blocked -- hover tracking.
32+ down: mouseArea .pressed
33+ background: Rectangle {
34+ implicitWidth: 32
35+ implicitHeight: 32
36+ visible: ! root .flat || root .down || root .checked || root .highlighted
37+ color: root .down ? root .Universal .baseMediumLowColor : root .enabled && (root .highlighted || root .checked ) ? root .Universal .accent : root .Universal .baseLowColor
38+ Rectangle {
39+ anchors .fill : parent
40+ color: " transparent"
41+ visible: root .enabled && mouseArea .containsMouse
42+ border .width : 2
43+ border .color : root .Universal .baseMediumLowColor
44+ }
45+ }
2646 MouseArea {
47+ id: mouseArea
2748 anchors .fill : parent
49+ hoverEnabled: true
50+ cursorShape: Qt .PointingHandCursor
2851 onClicked: root .clicked ()
2952 }
3053}
You can’t perform that action at this time.
0 commit comments