[vlc-commits] qml: focus volumebtn on left navigation in VolumeWidget
Prince Gupta
git at videolan.org
Mon Feb 8 10:00:14 UTC 2021
vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Tue Jan 19 18:21:00 2021 +0530| [2ba6735fb9fe938545ed473dfba338029e490b53] | committer: Pierre Lamot
qml: focus volumebtn on left navigation in VolumeWidget
Signed-off-by: Pierre Lamot <pierre at videolabs.io>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2ba6735fb9fe938545ed473dfba338029e490b53
---
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
More information about the vlc-commits
mailing list