[vlc-commits] qml: also accept keys on press that are handled on release event in Navigable view

Pierre Lamot git at videolan.org
Fri Jan 10 15:06:31 CET 2020


vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Tue Dec 17 13:16:44 2019 +0100| [fb810347b663ec66c7f72ff811221af7be2b87c4] | committer: Jean-Baptiste Kempf

qml: also accept keys on press that are handled on release event in Navigable view

  this ensure the event won't be interpreted twice (once on press,
  once on release)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fb810347b663ec66c7f72ff811221af7be2b87c4
---

 modules/gui/qt/widgets/qml/ExpandGridView.qml       | 3 +++
 modules/gui/qt/widgets/qml/KeyNavigableGridView.qml | 3 +++
 modules/gui/qt/widgets/qml/KeyNavigableListView.qml | 5 +++++
 3 files changed, 11 insertions(+)

diff --git a/modules/gui/qt/widgets/qml/ExpandGridView.qml b/modules/gui/qt/widgets/qml/ExpandGridView.qml
index 915d8c2af0..4b6f49952f 100644
--- a/modules/gui/qt/widgets/qml/ExpandGridView.qml
+++ b/modules/gui/qt/widgets/qml/ExpandGridView.qml
@@ -463,6 +463,9 @@ NavigableFocusScope {
             }
         } else if (KeyHelper.matchPageUp(event)) {
             newIndex = Math.max(0, currentIndex - colCount * 5)
+        } else if (KeyHelper.matchOk(event) || event.matches(StandardKey.SelectAll) ) {
+            //these events are matched on release
+            event.accepted = true
         }
 
         if (newIndex != -1 && newIndex != currentIndex) {
diff --git a/modules/gui/qt/widgets/qml/KeyNavigableGridView.qml b/modules/gui/qt/widgets/qml/KeyNavigableGridView.qml
index 69c65747bf..cea95a75a5 100644
--- a/modules/gui/qt/widgets/qml/KeyNavigableGridView.qml
+++ b/modules/gui/qt/widgets/qml/KeyNavigableGridView.qml
@@ -90,6 +90,9 @@ NavigableFocusScope {
                 }
             } else if (KeyHelper.matchPageUp(event)) {
                 newIndex = Math.max(0, currentIndex - _colCount * 5)
+            } else if (KeyHelper.matchOk(event) || event.matches(StandardKey.SelectAll) ) {
+                //these events are matched on release
+                event.accepted = true
             }
 
             if (newIndex >= 0 && newIndex < modelCount && newIndex != currentIndex) {
diff --git a/modules/gui/qt/widgets/qml/KeyNavigableListView.qml b/modules/gui/qt/widgets/qml/KeyNavigableListView.qml
index 0ecc2ef8d1..fe71af1cd7 100644
--- a/modules/gui/qt/widgets/qml/KeyNavigableListView.qml
+++ b/modules/gui/qt/widgets/qml/KeyNavigableListView.qml
@@ -176,6 +176,11 @@ NavigableFocusScope {
                 }
             }
 
+            if (KeyHelper.matchOk(event) || event.matches(StandardKey.SelectAll) ) {
+                //these events are matched on release
+                event.accepted = true
+            }
+
             if (newIndex >= 0 && newIndex < modelCount) {
                 var oldIndex = currentIndex
                 currentIndex = newIndex



More information about the vlc-commits mailing list