[vlc-commits] [Git][videolan/vlc][master] 3 commits: qml: fix broken anchor in IconToolButton

Thomas Guillem (@tguillem) gitlab at videolan.org
Fri Dec 22 08:04:36 UTC 2023



Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
b05c04a8 by Fatih Uzunoglu at 2023-12-22T06:04:23+00:00
qml: fix broken anchor in IconToolButton

- - - - -
67a816e4 by Fatih Uzunoglu at 2023-12-22T06:04:23+00:00
qml: fix broken code in PlaybackSpeedButton

- - - - -
ab4b8dcc by Fatih Uzunoglu at 2023-12-22T06:04:23+00:00
qml: add wheel and right-click functionality to PlaybackSpeedButton

- - - - -


3 changed files:

- modules/gui/qt/player/qml/PlaybackSpeed.qml
- modules/gui/qt/player/qml/controlbarcontrols/PlaybackSpeedButton.qml
- modules/gui/qt/widgets/qml/IconToolButton.qml


Changes:

=====================================
modules/gui/qt/player/qml/PlaybackSpeed.qml
=====================================
@@ -29,6 +29,8 @@ import "qrc:///util/Helpers.js" as Helpers
 ColumnLayout {
     id: root
 
+    property alias slider: slider
+
     // Private
 
     property var _model: [{ "value": 0.25 },


=====================================
modules/gui/qt/player/qml/controlbarcontrols/PlaybackSpeedButton.qml
=====================================
@@ -41,10 +41,9 @@ PopupIconToolButton {
         Navigation.rightItem: root
     }
 
-    // Children
-
-    T.Label {
-        anchors.centerIn: parent
+    contentItem: T.Label {
+        verticalAlignment: Text.AlignVCenter
+        horizontalAlignment: Text.AlignHCenter
 
         font.pixelSize: VLCStyle.fontSize_normal
 
@@ -53,4 +52,55 @@ PopupIconToolButton {
 
         color: root.color
     }
+
+    // TODO: Qt 5.15 Use WheelHandler & TapHandler
+    MouseArea {
+        anchors.fill: parent
+
+        acceptedButtons: Qt.RightButton
+
+        onWheel: function(wheel) {
+            if (!root.popup.contentItem || !root.popup.contentItem.slider) {
+                wheel.accepted = false
+                return
+            }
+
+            let delta = 0
+
+            if (wheel.angleDelta.x)
+                delta = wheel.angleDelta.x
+            else if (wheel.angleDelta.y)
+                delta = wheel.angleDelta.y
+            else {
+                wheel.accepted = false
+                return
+            }
+
+            if (wheel.inverted)
+                delta = -delta
+
+            wheel.accepted = true
+
+            delta = delta / 8 / 15
+
+            let func
+            if (delta > 0)
+                func = root.popup.contentItem.slider.increase
+            else
+                func = root.popup.contentItem.slider.decrease
+
+            for (let i = 0; i < Math.ceil(Math.abs(delta)); ++i)
+                func()
+        }
+
+        onClicked: function(mouse) {
+            if (!root.popup.contentItem || !root.popup.contentItem.slider) {
+                mouse.accepted = false
+                return
+            }
+
+            mouse.accepted = true
+            root.popup.contentItem.slider.value = 0
+        }
+    }
 }


=====================================
modules/gui/qt/widgets/qml/IconToolButton.qml
=====================================
@@ -98,8 +98,6 @@ T.ToolButton {
     }
 
     contentItem: T.Label {
-        anchors.centerIn: parent
-
         verticalAlignment: Text.AlignVCenter
         horizontalAlignment: Text.AlignHCenter
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b905473ea05e2d4341bbf14b9e884c8ab003e723...ab4b8dcc860b3e1693c0256ddf60c09e716c460f

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b905473ea05e2d4341bbf14b9e884c8ab003e723...ab4b8dcc860b3e1693c0256ddf60c09e716c460f
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