[vlc-commits] [Git][videolan/vlc][master] 3 commits: qml: remove unrequired 'selected' update in ExpandGridView

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Apr 23 06:25:06 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
d0fdb21e by Prince Gupta at 2024-04-23T05:47:08+00:00
qml: remove unrequired 'selected' update in ExpandGridView

they're updated based on selectionModel signal separately

- - - - -
c1e32484 by Prince Gupta at 2024-04-23T05:47:08+00:00
qml: improve initialization sequence in ExpandGridView

only set initialization flag after component is completed, try to avoid forceRelayout

- - - - -
ad28b9f9 by Prince Gupta at 2024-04-23T05:47:08+00:00
qml: remove unused property

- - - - -


2 changed files:

- modules/gui/qt/medialibrary/qml/MusicAlbums.qml
- modules/gui/qt/widgets/qml/ExpandGridView.qml


Changes:

=====================================
modules/gui/qt/medialibrary/qml/MusicAlbums.qml
=====================================
@@ -31,8 +31,6 @@ MainInterface.MainViewLoader {
 
     // Properties
 
-    property var gridViewRowX: currentItem?.rowX ?? 0
-
     readonly property var currentIndex: currentItem?.currentIndex ?? - 1
 
     property Component header: null


=====================================
modules/gui/qt/widgets/qml/ExpandGridView.qml
=====================================
@@ -63,7 +63,6 @@ FocusScope {
     // default is true
     property bool reuseItems: true
 
-    property int rowX: 0
     property int horizontalSpacing: VLCStyle.column_spacing
     property int verticalSpacing: VLCStyle.column_spacing
 
@@ -177,7 +176,10 @@ FocusScope {
 
     // Events
 
-    Component.onCompleted: flickable.layout(true)
+    Component.onCompleted: {
+        if (_initialize())
+            flickable.layout(true)
+    }
 
     onHeightChanged: flickable.layout(false)
 
@@ -493,15 +495,21 @@ FocusScope {
 
     // Private
 
+    // returns true if this requires forceLayout
     function _initialize() {
         if (_isInitialised)
             return;
 
+        _isInitialised = true;
         if (flickable.width === 0 || flickable.height === 0)
-            return;
-        if (currentIndex !== 0)
+            return false;
+
+        if (currentIndex !== 0) {
             positionViewAtIndex(currentIndex, ItemView.Contain)
-        _isInitialised = true;
+            return false; // positionViewAtIndex will cause layout
+        }
+
+        return true
     }
 
     function _calculateCurrentRange() {
@@ -559,9 +567,6 @@ FocusScope {
         item.x = x
         item.y = y
         item.z = _indexToZ(id)
-
-        // update required property (do we need this??)
-        item.selected = selectionModel.isSelected(id)
     }
 
     function _repositionItem(id, x, y) {
@@ -903,9 +908,7 @@ FocusScope {
             if (flickable.width === 0 || flickable.height === 0)
                 return
             else if (!root._isInitialised)
-                root._initialize()
-
-            root.rowX = getItemPos(0)[0]
+                return
 
             const expandItemGridId = getExpandItemGridId()
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/109d4af43418307eea1fa5dcf59eab9d98f9ca6e...ad28b9f96d39023260f513cf2d7b531568d656ca

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/109d4af43418307eea1fa5dcf59eab9d98f9ca6e...ad28b9f96d39023260f513cf2d7b531568d656ca
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