Skip to content

Use QtQuick Control-based list items #2789

@blammit

Description

@blammit

ListItem has a very generic layout that can be customised with various properties (content, bottomContent, caption, etc). It has a GridLayout that is fairly complex to handle all possible layout variations for these customisations. Ideally, it would not do any layouts, and all layouts could be implemented by ListItem-derived types instead.

We can do this by changing BaseListItem and ListItem to be derived from QtQuick Control, to provide the framework with which ListItem-derived types can implement their own layouts.

This will help with:

  • The portrait layout task, as some list items need to adjust their layouts in portrait orientation, and these custom adjustments cannot be reliably done in ListItem.
  • The list spacing bug Fix spacing issue in settings #2721, as the base list item can add a default spacing with bottomInset, instead of applying a generic spacing from the ListView or Column.
  • Implementing specialised layouts, as derived types no longer need hacks like modifying or referring to the ListItem primaryLabel to modify the generic ListItem layout.
  • Maintenance, as ListItem currently includes handling for special cases (e.g. activate() needs to ignore the ListNavigation case) and it will be more clear if those cases are handled in the derived types instead.
  • Performance, as each list item type only creates the items required for its API, instead of having the one-size-fits-all approach in ListItem.

Once this is done, list items will no longer set content.children or bottomContentLoader to implement custom layouts. Instead, they will set contentItem (and backgroundItem as needed) as per the Control API. Any custom contentItem will need to lay out the primary and caption labels themselves.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions