Skip to content

Draft: qt/qml: use built-in GridView in ExpandGridView

Fatih Uzunoğlu requested to merge fuzun/vlc:qml-gridview into master

This merge request explores the idea of using built-in GridView instead of reimplementing it.

Advantages:

  • Higher code maintainability.
  • Built-in GridView is faster.
  • Built-in GridView is already tested.

Theoretically, it should be possible by feeding the grid views two proxy models which properly maps the target model as if it was split in half. I created a class called SplitProxyModel based on QIdentityProxyModel which efficiently does this with no overhead.

GridView is already based on Flickable, so its interactive property should be set false. The flicking/dragging/scrolling is managed by the parent Flickable. The grid views have height set to its contentHeight so they are always full height.

layout

How delegate lifecycle is managed if views are always at full height? This is done by setting negative displayMarginBeginning and displayMarginEnd.

This is in draft status for now because it requires too much work to be completely integrated, and I don't want to waste time if there is no interest in this.

Because model roles are exposed as context properties, I had to modify the delegates. In the future, required properties should be used to capture the exposed context properties.

Merge request reports

Loading