[vlc-commits] qml: leave space for section lables in KeyNavigableTableView

Prince Gupta git at videolan.org
Wed Jun 24 17:41:53 CEST 2020


vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Tue Jun 16 15:46:45 2020 +0530| [1b9ecee821a6eb194cba34021f60a813407a2bf9] | committer: Pierre Lamot

qml: leave space for section lables in KeyNavigableTableView

introduce property availableRowWidth in KeyNavigableTable which all views can use to calculate max columns

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

 modules/gui/qt/medialibrary/qml/MusicAlbumsGridExpandDelegate.qml | 2 +-
 modules/gui/qt/medialibrary/qml/MusicTrackListDisplay.qml         | 5 +++--
 modules/gui/qt/medialibrary/qml/VideoListDisplay.qml              | 5 +++--
 modules/gui/qt/widgets/qml/KeyNavigableTableView.qml              | 1 +
 4 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/modules/gui/qt/medialibrary/qml/MusicAlbumsGridExpandDelegate.qml b/modules/gui/qt/medialibrary/qml/MusicAlbumsGridExpandDelegate.qml
index eb1439248b..3b0512c8d0 100644
--- a/modules/gui/qt/medialibrary/qml/MusicAlbumsGridExpandDelegate.qml
+++ b/modules/gui/qt/medialibrary/qml/MusicAlbumsGridExpandDelegate.qml
@@ -146,7 +146,7 @@ Widgets.NavigableFocusScope {
             MusicTrackListDisplay {
                 id: expand_track_id
 
-                readonly property int _nbCols: VLCStyle.gridColumnsForWidth(expand_track_id.width)
+                readonly property int _nbCols: VLCStyle.gridColumnsForWidth(expand_track_id.availableRowWidth)
 
                 section.property: ""
 
diff --git a/modules/gui/qt/medialibrary/qml/MusicTrackListDisplay.qml b/modules/gui/qt/medialibrary/qml/MusicTrackListDisplay.qml
index 06d190e7e7..b23e9ee9ce 100644
--- a/modules/gui/qt/medialibrary/qml/MusicTrackListDisplay.qml
+++ b/modules/gui/qt/medialibrary/qml/MusicTrackListDisplay.qml
@@ -99,8 +99,9 @@ Widgets.KeyNavigableTableView {
         }
     }
 
-    sortModel: ( width < VLCStyle.colWidth(6) ) ? sortModelSmall
-                                                : ( width < VLCStyle.colWidth(9) ) ? sortModelMedium : sortModelLarge
+    sortModel: ( availableRowWidth < VLCStyle.colWidth(6) ) ? sortModelSmall
+                                                            : ( availableRowWidth < VLCStyle.colWidth(9) )
+                                                              ? sortModelMedium : sortModelLarge
     section.property: "title_first_symbol"
 
     headerColor: VLCStyle.colors.bg
diff --git a/modules/gui/qt/medialibrary/qml/VideoListDisplay.qml b/modules/gui/qt/medialibrary/qml/VideoListDisplay.qml
index 9f75de7ab6..0911421f22 100644
--- a/modules/gui/qt/medialibrary/qml/VideoListDisplay.qml
+++ b/modules/gui/qt/medialibrary/qml/VideoListDisplay.qml
@@ -51,8 +51,9 @@ Widgets.KeyNavigableTableView {
     ]
 
 
-    sortModel: ( width < VLCStyle.colWidth(6) ) ? sortModelSmall
-                                                : ( width < VLCStyle.colWidth(7) ) ? sortModelMedium : sortModelLarge
+    sortModel: ( availableRowWidth < VLCStyle.colWidth(6) ) ? sortModelSmall
+                                                            : ( availableRowWidth < VLCStyle.colWidth(7) )
+                                                              ? sortModelMedium : sortModelLarge
     section.property: "title_first_symbol"
 
     rowHeight: VLCStyle.listAlbumCover_height + VLCStyle.margin_xxsmall * 2
diff --git a/modules/gui/qt/widgets/qml/KeyNavigableTableView.qml b/modules/gui/qt/widgets/qml/KeyNavigableTableView.qml
index 4eb8e27991..f1bd762f39 100644
--- a/modules/gui/qt/widgets/qml/KeyNavigableTableView.qml
+++ b/modules/gui/qt/widgets/qml/KeyNavigableTableView.qml
@@ -61,6 +61,7 @@ NavigableFocusScope {
 
     property alias selectionModel: selectionModel
     property real rowHeight: VLCStyle.fontHeight_normal + VLCStyle.margin_large
+    readonly property real availableRowWidth: width - ( VLCStyle.table_section_width * 2 )
     property alias spacing: view.spacing
     property int horizontalSpacing: VLCStyle.column_margin_width
 



More information about the vlc-commits mailing list