[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: accept wheel event in VideoSurface

Steve Lhomme (@robUx4) gitlab at videolan.org
Mon Jul 29 07:56:11 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
de18d381 by Fatih Uzunoglu at 2024-07-29T07:07:13+00:00
qt: accept wheel event in VideoSurface

- - - - -
29a9f868 by Fatih Uzunoglu at 2024-07-29T07:07:13+00:00
qml: make PIPPlayer a control and use handlers instead of mouse area

- - - - -


2 changed files:

- modules/gui/qt/maininterface/videosurface.cpp
- modules/gui/qt/player/qml/PIPPlayer.qml


Changes:

=====================================
modules/gui/qt/maininterface/videosurface.cpp
=====================================
@@ -316,7 +316,7 @@ void VideoSurface::geometryChange(const QRectF& newGeometry, const QRectF& oldGe
 void VideoSurface::wheelEvent(QWheelEvent *event)
 {
     emit mouseWheeled(*event);
-    event->ignore();
+    event->accept();
 }
 #endif
 


=====================================
modules/gui/qt/player/qml/PIPPlayer.qml
=====================================
@@ -16,7 +16,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 import QtQuick
-import QtQuick.Controls
+import QtQuick.Templates as T
 
 import VLC.MainInterface
 import VLC.Style
@@ -24,7 +24,7 @@ import VLC.Widgets as Widgets
 import VLC.Playlist
 import VLC.Player
 
-Item {
+T.Control {
     id: root
     width: VLCStyle.dp(320, VLCStyle.scale)
     height: VLCStyle.dp(180, VLCStyle.scale)
@@ -44,102 +44,110 @@ Item {
     Accessible.focusable: false
     Accessible.name: qsTr("video content")
 
-    Connections {
-        target: mouseArea.drag
-        function onActiveChanged() {
-            root.anchors.left = undefined;
-            root.anchors.right = undefined
-            root.anchors.top = undefined
-            root.anchors.bottom = undefined
-            root.anchors.verticalCenter = undefined;
-            root.anchors.horizontalCenter = undefined
-        }
-    }
-    Drag.active: mouseArea.drag.active
+    Drag.active: dragHandler.active
 
-    VideoSurface {
-        id: videoSurface
+    Drag.onActiveChanged: {
+        root.anchors.left = undefined
+        root.anchors.right = undefined
+        root.anchors.top = undefined
+        root.anchors.bottom = undefined
+        root.anchors.verticalCenter = undefined
+        root.anchors.horizontalCenter = undefined
+    }
 
+    DoubleClickIgnoringItem {
         anchors.fill: parent
 
-        enabled: root.enabled
-        visible: root.visible
+        TapHandler {
+            gesturePolicy: TapHandler.WithinBounds
 
-        ctx: MainCtx
-    }
+            onDoubleTapped: History.push(["player"])
+            onTapped: MainPlaylistController.togglePlayPause()
+        }
 
-    MouseArea {
-        id: mouseArea
+        DragHandler {
+            id: dragHandler
 
-        anchors.fill: videoSurface
-        z: 1
+            target: root
 
-        hoverEnabled: true
-        onClicked: MainPlaylistController.togglePlayPause()
-        onDoubleClicked: History.push(["player"])
+            cursorShape: Qt.DragMoveCursor
 
-        enabled: root.enabled
-        visible: root.visible
+            dragThreshold: 0
 
-        cursorShape: drag.active ? Qt.DragMoveCursor : undefined
-        drag.target: root
-        drag.minimumX: root.dragXMin
-        drag.minimumY: root.dragYMin
-        drag.maximumX: root.dragXMax
-        drag.maximumY: root.dragYMax
+            grabPermissions: PointerHandler.CanTakeOverFromAnything
 
-        onWheel: wheel.accepted = true
+            xAxis.minimum: root.dragXMin
+            xAxis.maximum: root.dragXMax
+            yAxis.minimum: root.dragYMin
+            yAxis.maximum: root.dragYMax
+        }
 
-        Rectangle {
-            color: "#10000000"
-            anchors.fill: parent
-            visible: parent.containsMouse
+        HoverHandler {
+            id: hoverHandler
 
-            Widgets.IconButton {
-                anchors.centerIn: parent
+            grabPermissions: PointerHandler.CanTakeOverFromAnything
+            cursorShape: Qt.ArrowCursor
+        }
+    }
 
-                font.pixelSize: VLCStyle.icon_large
+    background: VideoSurface {
+        id: videoSurface
+        ctx: MainCtx
+    }
 
-                description: qsTr("play/pause")
-                text: (Player.playingState !== Player.PLAYING_STATE_PAUSED
-                       && Player.playingState !== Player.PLAYING_STATE_STOPPED)
-                      ? VLCIcons.pause_filled
-                      : VLCIcons.play_filled
+    contentItem: Rectangle {
+        color: "#10000000"
+        visible: hoverHandler.hovered
 
-                onClicked: MainPlaylistController.togglePlayPause()
-            }
+        Widgets.IconButton {
+            anchors.centerIn: parent
 
-            Widgets.IconButton {
-                anchors {
-                    top: parent.top
-                    topMargin: VLCStyle.margin_small
-                    right: parent.right
-                    rightMargin: VLCStyle.margin_small
-                }
+            font.pixelSize: VLCStyle.icon_large
 
-                font.pixelSize: VLCStyle.icon_PIP
-                description: qsTr("close video")
-                text: VLCIcons.close
+            description: qsTr("play/pause")
+            text: (Player.playingState !== Player.PLAYING_STATE_PAUSED
+                   && Player.playingState !== Player.PLAYING_STATE_STOPPED)
+                  ? VLCIcons.pause_filled
+                  : VLCIcons.play_filled
 
-                onClicked: MainPlaylistController.stop()
-            }
+            hoverEnabled: MainCtx.qtQuickControlRejectsHoverEvents()
 
+            onClicked: MainPlaylistController.togglePlayPause()
+        }
 
-            Widgets.IconButton {
-                anchors {
-                    top: parent.top
-                    topMargin: VLCStyle.margin_small
-                    left: parent.left
-                    leftMargin: VLCStyle.margin_small
-                }
+        Widgets.IconButton {
+            anchors {
+                top: parent.top
+                topMargin: VLCStyle.margin_small
+                right: parent.right
+                rightMargin: VLCStyle.margin_small
+            }
 
-                font.pixelSize: VLCStyle.icon_PIP
+            font.pixelSize: VLCStyle.icon_PIP
+            description: qsTr("close video")
+            text: VLCIcons.close
 
-                description: qsTr("maximize player")
-                text: VLCIcons.fullscreen
+            hoverEnabled: MainCtx.qtQuickControlRejectsHoverEvents()
 
-                onClicked: History.push(["player"])
+            onClicked: MainPlaylistController.stop()
+        }
+
+        Widgets.IconButton {
+            anchors {
+                top: parent.top
+                topMargin: VLCStyle.margin_small
+                left: parent.left
+                leftMargin: VLCStyle.margin_small
             }
+
+            font.pixelSize: VLCStyle.icon_PIP
+
+            description: qsTr("maximize player")
+            text: VLCIcons.fullscreen
+
+            hoverEnabled: MainCtx.qtQuickControlRejectsHoverEvents()
+
+            onClicked: History.push(["player"])
         }
     }
 }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4f774de3500856147388635a72e9ecc867e0d2cc...29a9f8687c91733a5126b84f6568633c72600cd9

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4f774de3500856147388635a72e9ecc867e0d2cc...29a9f8687c91733a5126b84f6568633c72600cd9
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