[vlc-commits] qml: allow LabelSeparator to embed a navigable widget

Pierre Lamot git at videolan.org
Fri Jan 10 15:06:43 CET 2020


vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Thu Dec 19 15:56:50 2019 +0100| [6edf37752e7902bc3fdc1eb8c5feadf67c007fc3] | committer: Jean-Baptiste Kempf

qml: allow LabelSeparator to embed a navigable widget

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6edf37752e7902bc3fdc1eb8c5feadf67c007fc3
---

 modules/gui/qt/widgets/qml/LabelSeparator.qml | 75 +++++++++++++++++++--------
 1 file changed, 52 insertions(+), 23 deletions(-)

diff --git a/modules/gui/qt/widgets/qml/LabelSeparator.qml b/modules/gui/qt/widgets/qml/LabelSeparator.qml
index 6fc4803698..5aa1b8f86c 100644
--- a/modules/gui/qt/widgets/qml/LabelSeparator.qml
+++ b/modules/gui/qt/widgets/qml/LabelSeparator.qml
@@ -17,41 +17,70 @@
  *****************************************************************************/
 import QtQuick 2.11
 import QtQuick.Controls 2.4
+import QtQuick.Layouts 1.3
 
 import "qrc:///style/"
+import "qrc:///widgets/" as Widgets
 
-Item{
+Widgets.NavigableFocusScope {
     id: control
-    height: childrenRect.height
+    height: implicitHeight
+    width: implicitWidth
+    implicitHeight: colLayout.implicitHeight + VLCStyle.margin_small * 2
+    implicitWidth: colLayout.implicitWidth + VLCStyle.margin_large
 
     property alias text: txt.text
+    property alias font: txt.font
+    property alias color: txt.color
 
-    Label {
-        id: txt
-        font.pixelSize: VLCStyle.fontSize_xxlarge
-        color: VLCStyle.colors.text
-        font.weight: Font.Bold
-        anchors{
-            left: control.left
-            right: control.right
-            topMargin: VLCStyle.margin_small
-            leftMargin: VLCStyle.margin_large
+    property Component inlineComponent: Item {}
 
+    ColumnLayout {
+        id: colLayout
+        anchors.fill: parent
+        anchors.leftMargin: VLCStyle.margin_large
+        anchors.topMargin: VLCStyle.margin_small
+        anchors.bottomMargin: VLCStyle.margin_small
+
+        RowLayout {
+            id: rowLayout
+
+            Layout.fillHeight: true
+            Layout.preferredHeight: rowLayout.implicitHeight
+            Layout.fillWidth: true
+
+            Label {
+                id: txt
+
+                Layout.fillWidth: true
+                Layout.alignment: Qt.AlignLeft | Qt.AlignBottom
+
+                font.pixelSize: VLCStyle.fontSize_xxlarge
+                color: VLCStyle.colors.text
+                font.weight: Font.Bold
+                elide: Text.ElideRight
+            }
+
+            Loader {
+                id: inlineComponentLoader
+                Layout.preferredWidth: item.implicitWidth
+                active: !!inlineComponent
+                visible: active
+                focus: true
+                sourceComponent: inlineComponent
+            }
         }
-    }
 
-    Rectangle {
-        height: VLCStyle.heightBar_xxxsmall
-        radius: 2
+        Rectangle {
+            Layout.fillWidth: true
+            Layout.preferredHeight: height
+            height: VLCStyle.heightBar_xxxsmall
 
-        anchors{
-            left: control.left
-            right: control.right
-            top: txt.bottom
-            topMargin: VLCStyle.margin_small
-            leftMargin: VLCStyle.margin_large
+            radius: 2
 
+            color: VLCStyle.colors.bgAlt
         }
-        color: VLCStyle.colors.bgAlt
     }
+
+
 }



More information about the vlc-commits mailing list