[vlc-commits] [Git][videolan/vlc][master] qt/interface_window_handler: Update MediaLibrary key filtering condition

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Fri Jan 14 16:40:52 UTC 2022



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


Commits:
1bc3b616 by Benjamin Arnaud at 2022-01-14T16:22:12+00:00
qt/interface_window_handler: Update MediaLibrary key filtering condition

fix #26453

- - - - -


1 changed file:

- modules/gui/qt/maininterface/interface_window_handler.cpp


Changes:

=====================================
modules/gui/qt/maininterface/interface_window_handler.cpp
=====================================
@@ -356,30 +356,24 @@ bool InterfaceWindowHandler::applyKeyEvent(QKeyEvent * event) const
 {
     int key = event->key();
 
-    // NOTE: We have to make sure tab and backtab are never used as hotkeys.
-    if (key == Qt::Key_Tab || key == Qt::Key_Backtab)
-        return false;
-
-    // NOTE: When browsing the MediaLibrary, we let the view handle the navigation keys.
-    if (m_mainCtx->preferHotkeys() == false && (KeyHelper::matchLeft(event)  ||
-                                                KeyHelper::matchRight(event) ||
-                                                KeyHelper::matchUp(event)    ||
-                                                KeyHelper::matchDown(event)  ||
-                                                KeyHelper::matchCancel(event)))
+    // NOTE: We have to make sure tab and backtab are never used as hotkeys. When browsing the
+    //       MediaLibrary, we let the view handle the navigation keys.
+    if (key == Qt::Key_Tab || key == Qt::Key_Backtab || m_mainCtx->preferHotkeys() == false)
+    {
         return false;
+    }
 
     QQuickItem * item = p_intf->p_compositor->activeFocusItem();
 
-    if (item && item->inherits("QQuickControl"))
+    // NOTE: When this item is a control and has visual focus we let it handle the key.
+    if (item && item->inherits("QQuickControl")
+        &&
+        QQmlProperty(item, "visualFocus", qmlContext(item)).read().toBool())
     {
-        // NOTE: This item has visual focus so we let it handle the key.
-        if (QQmlProperty(item, "visualFocus", qmlContext(item)).read().toBool())
-            return false;
-
-        event->accept();
-
-        return true;
+        return false;
     }
 
-    return false;
+    event->accept();
+
+    return true;
 }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/1bc3b6160a1d6aed8d32ccf2fe5545881df35121

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




More information about the vlc-commits mailing list