[vlc-commits] [Git][videolan/vlc][master] qml: Added isSortable flag in the list view colModels

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Apr 27 22:03:48 UTC 2024



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
98efe8ad by Ash V at 2024-04-27T21:33:38+00:00
qml: Added isSortable flag in the list view colModels

Implemented isSortable key/flag in the qml list view colModels for KeyNavigableTableView.

Fixes Issue: #28503

- - - - -


8 changed files:

- modules/gui/qt/medialibrary/qml/MusicGenres.qml
- modules/gui/qt/medialibrary/qml/PlaylistMedia.qml
- modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml
- modules/gui/qt/medialibrary/qml/UrlListDisplay.qml
- modules/gui/qt/medialibrary/qml/VideoListDisplay.qml
- modules/gui/qt/network/qml/BrowseDeviceView.qml
- modules/gui/qt/network/qml/BrowseTreeDisplay.qml
- modules/gui/qt/widgets/qml/KeyNavigableTableView.qml


Changes:

=====================================
modules/gui/qt/medialibrary/qml/MusicGenres.qml
=====================================
@@ -238,6 +238,8 @@ MainInterface.MainViewLoader {
 
                     text: qsTr("Cover"),
 
+                    isSortable: false,
+
                     headerDelegate: tableColumns.titleHeaderDelegate,
                     colDelegate: tableColumns.titleDelegate
                 }
@@ -255,7 +257,9 @@ MainInterface.MainViewLoader {
                 model: {
                     criteria: "nb_tracks",
 
-                    text: qsTr("Tracks")
+                    text: qsTr("Tracks"),
+
+                    isSortable: false
                 }
             }]
 


=====================================
modules/gui/qt/medialibrary/qml/PlaylistMedia.qml
=====================================
@@ -56,6 +56,8 @@ MainInterface.MainTableView {
 
             text: qsTr("Title"),
 
+            isSortable: false,
+
             headerDelegate: table.titleHeaderDelegate,
             colDelegate   : table.titleDelegate,
 
@@ -71,6 +73,8 @@ MainInterface.MainTableView {
 
             text: qsTr("Cover"),
 
+            isSortable: false,
+
             type: "image",
 
             headerDelegate: table.titleHeaderDelegate,
@@ -84,7 +88,9 @@ MainInterface.MainTableView {
         model: {
             criteria: "title",
 
-            text: qsTr("Title")
+            text: qsTr("Title"),
+
+            isSortable: false
         }
     }, {
         size: 1,
@@ -94,6 +100,8 @@ MainInterface.MainTableView {
 
             text: qsTr("Duration"),
 
+            isSortable: false,
+
             headerDelegate: table.timeHeaderDelegate,
             colDelegate   : table.timeColDelegate
         }


=====================================
modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml
=====================================
@@ -283,6 +283,8 @@ MainInterface.MainViewLoader {
 
                     text: qsTr("Cover"),
 
+                    isSortable: false,
+
                     headerDelegate: columns.titleHeaderDelegate,
                     colDelegate   : columns.titleDelegate
                 }
@@ -300,7 +302,9 @@ MainInterface.MainViewLoader {
                 model: {
                     criteria: "count",
 
-                    text: qsTr("Tracks")
+                    text: qsTr("Tracks"),
+
+                    isSortable: false
                 }
             }]
 


=====================================
modules/gui/qt/medialibrary/qml/UrlListDisplay.qml
=====================================
@@ -58,6 +58,8 @@ Widgets.KeyNavigableTableView {
 
             text: qsTr("Url"),
 
+            isSortable: false,
+
             showSection: "url",
 
             headerDelegate: urlHeaderDelegate
@@ -70,6 +72,8 @@ Widgets.KeyNavigableTableView {
 
             text: qsTr("Last played date"),
 
+            isSortable: false,
+
             showSection: "",
             showContextButton: true,
 


=====================================
modules/gui/qt/medialibrary/qml/VideoListDisplay.qml
=====================================
@@ -73,6 +73,8 @@ MainInterface.MainTableView {
 
             text: qsTr("Cover"),
 
+            isSortable: false,
+
             showSection: "",
 
             placeHolder: VLCStyle.noArtVideoCover,


=====================================
modules/gui/qt/network/qml/BrowseDeviceView.qml
=====================================
@@ -257,6 +257,8 @@ FocusScope {
 
                     text: qsTr("Cover"),
 
+                    isSortable: false,
+
                     headerDelegate: artworkHeader,
                     colDelegate: artworkColumn
                 }


=====================================
modules/gui/qt/network/qml/BrowseTreeDisplay.qml
=====================================
@@ -242,6 +242,8 @@ MainInterface.MainViewLoader {
 
                     text: qsTr("Cover"),
 
+                    isSortable: false,
+
                     headerDelegate: thumbnailHeader,
                     colDelegate: thumbnailColumn
                 }


=====================================
modules/gui/qt/widgets/qml/KeyNavigableTableView.qml
=====================================
@@ -331,7 +331,9 @@ FocusScope {
                                 }
                             }
                             onClicked: {
-                                if (root.model.sortCriteria !== modelData.model.criteria)
+                                if (!(modelData.model.isSortable ?? true))
+                                    return
+                                else if (root.model.sortCriteria !== modelData.model.criteria)
                                     root.model.sortCriteria = modelData.model.criteria
                                 else
                                     root.model.sortOrder = (root.model.sortOrder === Qt.AscendingOrder) ? Qt.DescendingOrder : Qt.AscendingOrder



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/98efe8ad5f3a4e18564319cd67cd7b5eda14068c

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/98efe8ad5f3a4e18564319cd67cd7b5eda14068c
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list