[vlc-commits] [Git][videolan/vlc][master] qml: fix actionAtIndex being emitted when key wasn't pressed in ExpandGridView

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Sun Aug 22 14:47:55 UTC 2021



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
6797c5ac by Pierre Lamot at 2021-08-22T14:35:04+00:00
qml: fix actionAtIndex being emitted when key wasn't pressed in ExpandGridView

  this happened when the focus was on another component (ie: the contextual menu)
  when the key was pressed

- - - - -


1 changed file:

- modules/gui/qt/widgets/qml/ExpandGridView.qml


Changes:

=====================================
modules/gui/qt/widgets/qml/ExpandGridView.qml
=====================================
@@ -59,6 +59,8 @@ FocusScope {
 
     property bool _isInitialised: false
 
+    property bool _releaseActionButtonPressed: false
+
     /// the id of the item to be expanded
     property int expandIndex: -1
     property int _newExpandIndex: -1
@@ -702,6 +704,12 @@ FocusScope {
             event.accepted = true
         }
 
+        if (event.matches(StandardKey.SelectAll) || KeyHelper.matchOk(event)) {
+            _releaseActionButtonPressed = true
+        } else {
+            _releaseActionButtonPressed = false
+        }
+
         if (newIndex !== -1 && newIndex !== currentIndex) {
             event.accepted = true
             var oldIndex = currentIndex
@@ -715,6 +723,9 @@ FocusScope {
     }
 
     Keys.onReleased: {
+        if (!_releaseActionButtonPressed)
+            return
+
         if (event.matches(StandardKey.SelectAll)) {
             event.accepted = true
             root.selectAll()
@@ -722,5 +733,6 @@ FocusScope {
             event.accepted = true
             root.actionAtIndex(currentIndex)
         }
+        _releaseActionButtonPressed = false
     }
 }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6797c5ac025072e801096c58b48f63e7498b928e

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6797c5ac025072e801096c58b48f63e7498b928e
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list