[vlc-commits] [Git][videolan/vlc][master] 4 commits: qt: introduce `MainCtx::setFiltersChildMouseEvents()`

Steve Lhomme (@robUx4) gitlab at videolan.org
Sun Jan 19 16:06:33 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
b2dbe8d3 by Fatih Uzunoglu at 2025-01-19T15:53:46+00:00
qt: introduce `MainCtx::setFiltersChildMouseEvents()`

- - - - -
e87cc1cd by Fatih Uzunoglu at 2025-01-19T15:53:46+00:00
qml: make pip player hover handler blocking

- - - - -
2e4df9db by Fatih Uzunoglu at 2025-01-19T15:53:46+00:00
qml: disable filtering child mouse events in `ListViewExt.qml`

- - - - -
9b86a3b4 by Fatih Uzunoglu at 2025-01-19T15:53:46+00:00
qml: disable filtering child mouse events in `ExpandGridView` flickable

- - - - -


4 changed files:

- modules/gui/qt/maininterface/mainctx.hpp
- modules/gui/qt/player/qml/PIPPlayer.qml
- modules/gui/qt/widgets/qml/ExpandGridView.qml
- modules/gui/qt/widgets/qml/ListViewExt.qml


Changes:

=====================================
modules/gui/qt/maininterface/mainctx.hpp
=====================================
@@ -294,6 +294,12 @@ public:
 
     Q_INVOKABLE QJSValue urlListToMimeData(const QJSValue& array);
 
+    Q_INVOKABLE static void setFiltersChildMouseEvents(QQuickItem *item, bool enable)
+    {
+        assert(item);
+        item->setFiltersChildMouseEvents(enable);
+    }
+
     /**
      * @brief ask for the application to terminate
      */


=====================================
modules/gui/qt/player/qml/PIPPlayer.qml
=====================================
@@ -88,6 +88,11 @@ T.Control {
 
             grabPermissions: PointerHandler.CanTakeOverFromAnything
             cursorShape: Qt.ArrowCursor
+
+            Component.onCompleted: {
+                if (typeof blocking === 'boolean')
+                    blocking = true // Qt 6.3 feature
+            }
         }
     }
 


=====================================
modules/gui/qt/widgets/qml/ExpandGridView.qml
=====================================
@@ -781,6 +781,25 @@ FocusScope {
             id: flickableScrollBar
         }
 
+        Component.onCompleted: {
+            // Flickable filters child mouse events for flicking (even when
+            // the delegate is grabbed). However, this is not a useful
+            // feature for non-touch cases, so disable it here and enable
+            // it if touch is detected through the hover handler:
+            MainCtx.setFiltersChildMouseEvents(this, false)
+        }
+
+        HoverHandler {
+            acceptedDevices: PointerDevice.TouchScreen
+
+            onHoveredChanged: {
+                if (hovered)
+                    MainCtx.setFiltersChildMouseEvents(flickable, true)
+                else
+                    MainCtx.setFiltersChildMouseEvents(flickable, false)
+            }
+        }
+
         TapHandler {
             acceptedButtons: Qt.LeftButton | Qt.RightButton
 


=====================================
modules/gui/qt/widgets/qml/ListViewExt.qml
=====================================
@@ -338,6 +338,25 @@ ListView {
 
     // Events
 
+    Component.onCompleted: {
+        // Flickable filters child mouse events for flicking (even when
+        // the delegate is grabbed). However, this is not a useful
+        // feature for non-touch cases, so disable it here and enable
+        // it if touch is detected through the hover handler:
+        MainCtx.setFiltersChildMouseEvents(root, false)
+    }
+
+    HoverHandler {
+        acceptedDevices: PointerDevice.TouchScreen
+
+        onHoveredChanged: {
+            if (hovered)
+                MainCtx.setFiltersChildMouseEvents(root, true)
+            else
+                MainCtx.setFiltersChildMouseEvents(root, false)
+        }
+    }
+
     // NOTE: We always want a valid 'currentIndex' by default.
     onCountChanged: if (count && currentIndex === -1) currentIndex = 0
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fbe1b1e8b6a6adf3951b7a5f0ffe007b022da9b9...9b86a3b47a4508b2737904036fd80b7d8a1a94f6

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fbe1b1e8b6a6adf3951b7a5f0ffe007b022da9b9...9b86a3b47a4508b2737904036fd80b7d8a1a94f6
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list