Skip to content

Commit fcdafac

Browse files
Merge pull request #26044 from Eism/dynamics_popup_nav_fix
Dynamics popup navigation fix
2 parents 21fdb1b + 8b9f5a5 commit fcdafac

File tree

9 files changed

+123
-12
lines changed

9 files changed

+123
-12
lines changed

src/appshell/qml/NotationPage/NotationPage.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ DockPage {
569569
Component.onCompleted: {
570570
root.notationView = notationView.paintView
571571

572-
root.setDefaultNavigationControl(root.defaultNavigationControl)
572+
root.setDefaultNavigationControl(notationView.defaultNavigationControl)
573573
}
574574

575575
Component.onDestruction: {

src/notation/qml/MuseScore/NotationScene/internal/CapoPopup.qml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ StyledPopupView {
7575
name: "CapoSettings"
7676
direction: NavigationPanel.Vertical
7777
accessible.name: qsTrc("notation", "Capo settings")
78+
79+
onNavigationEvent: function(event) {
80+
if (event.type === NavigationEvent.Escape) {
81+
root.close()
82+
}
83+
}
7884
}
7985

8086
StyledTextLabel {

src/notation/qml/MuseScore/NotationScene/internal/DynamicPopup.qml

Lines changed: 63 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,40 @@ StyledPopupView {
5151
NavigationPanel {
5252
id: dynamicsNavPanel
5353
name: "DynamicsPopup"
54-
direction: NavigationPanel.Vertical
54+
direction: NavigationPanel.Horizontal
5555
section: root.notationViewNavigationSection
5656
order: root.navigationOrderStart
5757
accessible.name: qsTrc("notation", "Dynamics Popup")
58+
59+
onNavigationEvent: function(event) {
60+
if (event.type === NavigationEvent.Escape) {
61+
root.close()
62+
}
63+
}
64+
}
65+
66+
function goToPreviousPage() {
67+
if (currentPage > 0) {
68+
currentPage--
69+
} else {
70+
currentPage = dynamicModel.pages.length - 1
71+
}
72+
73+
Qt.callLater(requestNavigationActive, dynamicRepeater.count - 1)
74+
}
75+
76+
function goToNextPage() {
77+
if (currentPage < dynamicModel.pages.length - 1) {
78+
currentPage++
79+
} else {
80+
currentPage = 0
81+
}
82+
83+
Qt.callLater(requestNavigationActive, 0)
84+
}
85+
86+
function requestNavigationActive(index) {
87+
dynamicRepeater.itemAt(index).navigation.requestActive()
5888
}
5989

6090
FlatButton {
@@ -70,11 +100,7 @@ StyledPopupView {
70100
}
71101

72102
onClicked: {
73-
if (currentPage > 0) {
74-
currentPage--
75-
} else {
76-
currentPage = dynamicModel.pages.length - 1
77-
}
103+
content.goToPreviousPage()
78104
}
79105
}
80106

@@ -84,6 +110,7 @@ StyledPopupView {
84110

85111
Repeater {
86112
id: dynamicRepeater
113+
87114
model: dynamicModel.pages[currentPage]
88115

89116
delegate: FlatButton {
@@ -97,6 +124,35 @@ StyledPopupView {
97124
modelData.type === DynamicPopupModel.Crescendo ? crescHairpinComp :
98125
modelData.type === DynamicPopupModel.Decrescendo ? dimHairpinComp : null
99126

127+
navigation.panel: dynamicsNavPanel
128+
navigation.order: index
129+
accessible.name: modelData.accessibleName
130+
navigation.onNavigationEvent: function(event) {
131+
switch (event.type) {
132+
case NavigationEvent.Up:
133+
case NavigationEvent.Left: {
134+
if (index == 0) {
135+
content.goToPreviousPage()
136+
137+
event.accepted = true
138+
}
139+
140+
break
141+
}
142+
143+
case NavigationEvent.Right:
144+
case NavigationEvent.Down: {
145+
if (index == dynamicRepeater.count - 1) {
146+
content.goToNextPage()
147+
148+
event.accepted = true
149+
}
150+
151+
break
152+
}
153+
}
154+
}
155+
100156
Component {
101157
id: dynamicComp
102158

@@ -191,11 +247,7 @@ StyledPopupView {
191247
}
192248

193249
onClicked: {
194-
if (currentPage < dynamicModel.pages.length - 1) {
195-
currentPage++
196-
} else {
197-
currentPage = 0
198-
}
250+
content.goToNextPage()
199251
}
200252
}
201253
}

src/notation/qml/MuseScore/NotationScene/internal/HarpPedalPopup.qml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,12 @@ StyledPopupView {
122122
name: "PedalSettings"
123123
direction: NavigationPanel.Vertical
124124
accessible.name: qsTrc("notation", "Pedal settings buttons")
125+
126+
onNavigationEvent: function(event) {
127+
if (event.type === NavigationEvent.Escape) {
128+
root.close()
129+
}
130+
}
125131
}
126132

127133
// Accidental symbols
@@ -266,6 +272,12 @@ StyledPopupView {
266272
direction: NavigationPanel.Horizontal
267273
order: pedalSettingsNavPanel.order + 1
268274
accessible.name: qsTrc("notation", "Diagram type buttons")
275+
276+
onNavigationEvent: function(event) {
277+
if (event.type === NavigationEvent.Escape) {
278+
root.close()
279+
}
280+
}
269281
}
270282

271283
RoundedRadioButton {

src/notation/qml/MuseScore/NotationScene/internal/StringTuningsPopup.qml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ StyledPopupView {
7575
section: root.notationViewNavigationSection
7676
order: root.navigationOrderStart
7777
accessible.name: qsTrc("notation", "String tunings settings")
78+
79+
onNavigationEvent: function(event) {
80+
if (event.type === NavigationEvent.Escape) {
81+
root.close()
82+
}
83+
}
7884
}
7985

8086
StyledTextLabel {
@@ -135,6 +141,12 @@ StyledPopupView {
135141
section: root.notationViewNavigationSection
136142
order: navPanel.order + 1
137143
accessible.name: qsTrc("notation", "Strings")
144+
145+
onNavigationEvent: function(event) {
146+
if (event.type === NavigationEvent.Escape) {
147+
root.close()
148+
}
149+
}
138150
}
139151

140152
GridLayout {

src/notation/view/internal/dynamicpopupmodel.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "engraving/dom/dynamic.h"
2626
#include "engraving/dom/factory.h"
2727
#include "engraving/types/symnames.h"
28+
#include "engraving/types/typesconv.h"
2829

2930
#include "log.h"
3031

@@ -136,6 +137,7 @@ void DynamicPopupModel::init()
136137
for (const DynamicPopupModel::PageItem& item : page) {
137138
QVariantMap variantMap {
138139
{ "text", xmlTextToQString(Dynamic::dynamicText(item.dynType).toStdString(), engravingFont) },
140+
{ "accessibleName", TConv::userName(item.dynType).translated().toQString() },
139141
{ "width", item.width },
140142
{ "offset", item.offset },
141143
{ "type", item.itemType }

src/playback/qml/MuseScore/Playback/SoundFlagPopup.qml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ StyledPopupView {
9090
section: root.notationViewNavigationSection
9191
order: root.navigationOrderStart
9292
accessible.name: qsTrc("playback", "Sound flag settings")
93+
94+
onNavigationEvent: function(event) {
95+
if (event.type === NavigationEvent.Escape) {
96+
root.close()
97+
}
98+
}
9399
}
94100

95101
StyledIconLabel {
@@ -155,6 +161,10 @@ StyledPopupView {
155161

156162
navigationPanelSection: root.notationViewNavigationSection
157163
navigationPanelOrderStart: navPanel.order + 1
164+
165+
onCloseRequested: {
166+
root.close()
167+
}
158168
}
159169
}
160170
}

src/playback/qml/MuseScore/Playback/internal/SoundFlag/MuseSoundsParams.qml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ Item {
3838

3939
height: !noOptions ? content.childrenRect.height : noOptionsLabel.implicitHeight
4040

41+
signal closeRequested()
42+
4143
Column {
4244
id: content
4345

@@ -66,6 +68,10 @@ Item {
6668
onToggleParamRequested: {
6769
root.model.togglePreset(paramCode)
6870
}
71+
72+
onCloseRequested: {
73+
root.closeRequested()
74+
}
6975
}
7076

7177
ParamsGridView {
@@ -89,6 +95,10 @@ Item {
8995
onToggleParamRequested: {
9096
root.model.togglePlayingTechnique(paramCode)
9197
}
98+
99+
onCloseRequested: {
100+
root.closeRequested()
101+
}
92102
}
93103
}
94104

src/playback/qml/MuseScore/Playback/internal/SoundFlag/ParamsGridView.qml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,16 @@ Column {
4242
name: "SoundFlagParams" + title
4343
direction: NavigationPanel.Vertical
4444
accessible.name: title
45+
46+
onNavigationEvent: function(event) {
47+
if (event.type === NavigationEvent.Escape) {
48+
root.closeRequested()
49+
}
50+
}
4551
}
4652

4753
signal toggleParamRequested(string paramCode)
54+
signal closeRequested()
4855

4956
spacing: 8
5057

0 commit comments

Comments
 (0)