[vlc-devel] [PATCH 11/21] qml: better mainplayer controlbar alignment & navigation

Fatih Uzunoglu fuzun54 at outlook.com
Sat Nov 7 17:53:30 CET 2020


---
 modules/gui/qt/player/qml/ControlBar.qml | 30 ++++++++++++++++--------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/modules/gui/qt/player/qml/ControlBar.qml b/modules/gui/qt/player/qml/ControlBar.qml
index ec12f97ce2..d02503b3af 100644
--- a/modules/gui/qt/player/qml/ControlBar.qml
+++ b/modules/gui/qt/player/qml/ControlBar.qml
@@ -84,14 +84,15 @@ Widgets.NavigableFocusScope {
             Layout.alignment: Qt.AlignLeft | Qt.AlignTop
             Layout.fillWidth: true
             enabled: player.playingState == PlayerController.PLAYING_STATE_PLAYING || player.playingState == PlayerController.PLAYING_STATE_PAUSED
-            Keys.onDownPressed: buttons.focus = true
+            Keys.onDownPressed: buttons_left.focus = true
 
             parentWindow: mainInterfaceRect
         }
 
-        RowLayout {
+        Item {
             Layout.fillWidth: true
             Layout.bottomMargin: VLCStyle.margin_xsmall
+            Layout.preferredHeight: Math.max(buttons_left.implicitHeight, buttons_center.implicitHeight, buttons_right.implicitHeight)
 
             PlayerButtonsLayout {
                 id: buttons_left
@@ -101,6 +102,10 @@ Widgets.NavigableFocusScope {
 
                 focus: true
 
+                anchors.left: parent.left
+
+                visible: model.count > 0 && (playerControlBarModel_center.count > 0 ? ((x+width) < buttons_center.x) : true)
+
                 navigationParent: root
                 navigationUp: function(index) {
                     if (trackPositionSlider.enabled)
@@ -109,14 +114,12 @@ Widgets.NavigableFocusScope {
                         root.navigationUp(index)
                 }
 
+                navigationRightItem: buttons_center
+
                 Keys.priority: Keys.AfterItem
                 Keys.onPressed: defaultKeyAction(event, 0)
             }
 
-            Item {
-                Layout.fillWidth: true
-            }
-
             PlayerButtonsLayout {
                 id: buttons_center
 
@@ -125,6 +128,8 @@ Widgets.NavigableFocusScope {
 
                 focus: true
 
+                anchors.horizontalCenter: parent.horizontalCenter
+
                 navigationParent: root
                 navigationUp: function(index) {
                     if (trackPositionSlider.enabled)
@@ -133,15 +138,13 @@ Widgets.NavigableFocusScope {
                         root.navigationUp(index)
                 }
 
+                navigationLeftItem: buttons_left
+                navigationRightItem: buttons_right
 
                 Keys.priority: Keys.AfterItem
                 Keys.onPressed: defaultKeyAction(event, 0)
             }
 
-            Item {
-                Layout.fillWidth: true
-            }
-
             PlayerButtonsLayout {
                 id: buttons_right
 
@@ -150,6 +153,11 @@ Widgets.NavigableFocusScope {
 
                 focus: true
 
+                anchors.right: parent.right
+
+                visible: model.count > 0 && (playerControlBarModel_center.count > 0 ? ((buttons_center.x + buttons_center.width) < x)
+                                                                              : !(((buttons_left.x + buttons_left.width) > x) && playerControlBarModel_left.count > 0))
+
                 navigationParent: root
                 navigationUp: function(index) {
                     if (trackPositionSlider.enabled)
@@ -158,6 +166,8 @@ Widgets.NavigableFocusScope {
                         root.navigationUp(index)
                 }
 
+                navigationLeftItem: buttons_center
+
                 Keys.priority: Keys.AfterItem
                 Keys.onPressed: defaultKeyAction(event, 0)
             }
-- 
2.25.1



More information about the vlc-devel mailing list