[vlc-devel] [PATCH 23/33] qml: focus volumebtn on left navigation in VolumeWidget
Prince Gupta
guptaprince8832 at gmail.com
Wed Feb 3 10:56:39 UTC 2021
---
modules/gui/qt/player/qml/VolumeWidget.qml | 25 ++++++++++++++--------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/modules/gui/qt/player/qml/VolumeWidget.qml b/modules/gui/qt/player/qml/VolumeWidget.qml
index 2784b1382f..7e087495cf 100644
--- a/modules/gui/qt/player/qml/VolumeWidget.qml
+++ b/modules/gui/qt/player/qml/VolumeWidget.qml
@@ -51,6 +51,8 @@ FocusScope{
id: volumeWidget
Widgets.IconToolButton{
id: volumeBtn
+
+ focus: true
paintOnly: widgetfscope.paintOnly
size: VLCStyle.icon_normal
iconText:
@@ -68,6 +70,17 @@ FocusScope{
color: widgetfscope.color
onClicked: player.muted = !player.muted
KeyNavigation.right: volControl
+
+ Keys.onLeftPressed: {
+ var left = widgetfscope.KeyNavigation.left
+ while (left && (!left.enabled || !left.visible)) {
+ left = left.KeyNavigation ? left.KeyNavigation.left : undefined
+ }
+ if (left)
+ left.forceActiveFocus()
+ else if (!!navigationLeft)
+ navigationLeft()
+ }
}
Slider
@@ -82,7 +95,6 @@ FocusScope{
stepSize: 0.05
value: player.volume
opacity: player.muted ? 0.5 : 1
- focus: true
Accessible.name: i18n.qtr("Volume")
@@ -133,15 +145,10 @@ FocusScope{
else if (!!navigationRight)
navigationRight()
}
+
Keys.onLeftPressed: {
- var left = widgetfscope.KeyNavigation.left
- while (left && (!left.enabled || !left.visible)) {
- left = left.KeyNavigation ? left.KeyNavigation.left : undefined
- }
- if (left)
- left.forceActiveFocus()
- else if (!!navigationLeft)
- navigationLeft()
+ volumeBtn.forceActiveFocus()
+ event.accepted = true
}
property color sliderColor: (volControl.position > fullvolpos) ? colors.volmax : widgetfscope.color
--
2.25.1
More information about the vlc-devel
mailing list