[vlc-devel] [PATCH 09/30] qml: remove default top padding in KeyNaviagableTableView's headers

Prince Gupta guptaprince8832 at gmail.com
Mon Dec 14 14:27:47 CET 2020


make the same configurable by a new property `headerTopPadding`
---
 .../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 f1435b78c4..53f33204b6 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
@@ -101,7 +102,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
@@ -110,17 +111,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
@@ -136,8 +139,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 {
-- 
2.25.1



More information about the vlc-devel mailing list