File tree Expand file tree Collapse file tree 3 files changed +15
-26
lines changed
framework/uicomponents/qml/Muse/UiComponents
notation/qml/MuseScore/NotationScene Expand file tree Collapse file tree 3 files changed +15
-26
lines changed Original file line number Diff line number Diff line change @@ -103,8 +103,9 @@ FocusScope {
103103 }
104104
105105 signal clicked (var mouse)
106- // There are intentionally no "forwarded" signals here from the MouseArea, like `pressAndHold`
107- // See https://github.com/musescore/MuseScore/issues/16012#issuecomment-1399656043
106+ // The `pressAndHold` signal is intentionally not "forwarded" here from the MouseArea for performance reasons.
107+ // Most buttons don't use it and Qt has optimizations if no signal is attached. If a component needs it,
108+ // it can hook to it directly (the mouse area is exposed via the `mouseArea` alias property).
108109
109110 objectName: root .text
110111
Original file line number Diff line number Diff line change @@ -103,18 +103,13 @@ FlatButton {
103103 }
104104 }
105105
106- Connections {
107- target: root .mouseArea
108-
109- enabled: root .hasMenu && ! menuLoader .isMenuOpened
110-
111- function onPressAndHold () {
112- if (menuLoader .isMenuOpened || ! root .hasMenu ) {
113- return
114- }
115-
116- root .toggleMenuOpened ()
106+ mouseArea .onPressAndHold : function (event ) {
107+ if (menuLoader .isMenuOpened || ! root .hasMenu ) {
108+ event .accepted = false // do not suppress the click event
109+ return
117110 }
111+
112+ root .toggleMenuOpened ()
118113 }
119114
120115 Canvas {
Original file line number Diff line number Diff line change @@ -155,20 +155,13 @@ Item {
155155 }
156156 }
157157
158- Connections {
159- target: btn .mouseArea
160-
161- // Make sure we only connect to `pressAndHold` if necessary
162- // See https://github.com/musescore/MuseScore/issues/16012
163- enabled: btn .hasMenu && ! menuLoader .isMenuOpened
164-
165- function onPressAndHold () {
166- if (menuLoader .isMenuOpened || ! btn .hasMenu ) {
167- return
168- }
169-
170- btn .toggleMenuOpened ()
158+ mouseArea .onPressAndHold : function (event ) {
159+ if (menuLoader .isMenuOpened || ! btn .hasMenu ) {
160+ event .accepted = false // do not suppress the click event
161+ return
171162 }
163+
164+ btn .toggleMenuOpened ()
172165 }
173166
174167 StyledMenuLoader {
You can’t perform that action at this time.
0 commit comments