[vlc-commits] qml: remove default top padding in KeyNaviagableTableView's headers

Prince Gupta git at videolan.org
Thu Dec 17 14:57:08 UTC 2020


vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Thu Dec  3 20:28:25 2020 +0530| [5bb60167bb1823d49d207884fc7c9c6648e439fe] | committer: Pierre Lamot

qml: remove default top padding in KeyNaviagableTableView's headers

make the same configurable by a new property `headerTopPadding`

Signed-off-by: Pierre Lamot <pierre at videolabs.io>

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

 modules/gui/qt/widgets/qml/KeyNavigableTableView.qml | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/modules/gui/qt/widgets/qml/KeyNavigableTableView.qml b/modules/gui/qt/widgets/qml/KeyNavigableTableView.qml
index a5f1d238ec..ea9cc69be9 100644
--- a/modules/gui/qt/widgets/qml/KeyNavigableTableView.qml
+++ b/modules/gui/qt/widgets/qml/KeyNavigableTableView.qml
@@ -62,6 +62,7 @@ NavigableFocusScope {
     property var headerItem: view.headerItem.loadedHeader
     property alias tableHeaderItem: view.headerItem
     property color headerColor
+    property int headerTopPadding: 0
 
     property alias footerItem: view.footerItem
     property alias footer: view.footer
@@ -102,7 +103,7 @@ NavigableFocusScope {
             property alias loadedHeader: headerLoader.item
 
             width: parent.width
-            height: col.height + VLCStyle.margin_xsmall
+            height: col.height
             color: headerColor
             visible: view.modelCount > 0
             z: 3
@@ -111,17 +112,19 @@ NavigableFocusScope {
                 x: contentX - VLCStyle.table_section_width
                 y: row.y
                 height: row.height
+                topPadding: root.headerTopPadding
                 leftPadding: VLCStyle.table_section_text_margin
                 text: view.currentSection
                 color: VLCStyle.colors.accent
-                visible: text !== "" && view.contentY > (VLCStyle.fontHeight_normal + VLCStyle.margin_xxsmall - col.height)
+                visible: text !== "" && view.contentY > (row.height - col.height - row.topPadding)
+                verticalAlignment: Text.AlignTop
             }
 
             Column {
                 id: col
 
                 width: parent.width
-                height: childrenRect.height
+                height: implicitHeight
 
                 Loader {
                     id: headerLoader
@@ -137,8 +140,9 @@ NavigableFocusScope {
                         rightMargin: VLCStyle.margin_xxxsmall
                         horizontalCenter: parent.horizontalCenter
                     }
-                    height: childrenRect.height + VLCStyle.margin_xxsmall
-                    topPadding: VLCStyle.margin_xxsmall
+                    height: implicitHeight
+                    topPadding: root.headerTopPadding
+                    bottomPadding: VLCStyle.margin_xsmall
                     spacing: root.horizontalSpacing
 
                     Repeater {



More information about the vlc-commits mailing list