Skip to content

CardsGridView leftMargin calculation rework

Hello, This MR tries to optimize calculation of left margin of each delegate in CardsGridViewPrivate.qml by calculating the left margin by columns. Since each column has the same margin, I thought this approach was the best.

What does this MR do ?

  • GridView: initialize leftMargins array property on component completion, so it doesn't cause a TypeError when GridView width changes.
  • delegate: calculate left margin for current column, save it in the leftMargins array property and update its current one if current delegate is in the first row, otherwise just update leftMargin property to the one of the current column found in root.leftMargins.
  • fixes the problem of delegates being at the center when extraColumns is set to false
Edited by Matej Starc

Merge request reports