Skip to content

Card, CardsGridView, CardsLayout rework

This MR aims to improve Card (widgets used by it), CardsGridView, CardsLayout. How it works in the background and add extra features (e.g. alignment option, card size, BannerImage). These are some of my goals that myself already poorly implemented in testing branch a long time ago.

Changes made:

  • templates/AbstractCard.qml

    • no layout, only background, since this is a template and shouldn't have anything in it.
  • private/BannerImage & CardsGridViewPrivate

    • BannerImage: allowed to align to center vertically, shadowed rectangle expands vertically when rectangles height * 1.5 is higher than BannerImages height, better padding on opposite side of title alignment (less padding on bottom when aligned to top and the opposite)
    • CardsGridViewPrivate binds card size to size calculated by GridView (should do fewer calculations on width change)
  • controls/*

    • AbstractCard: is a card only with a layout (same as templates/AbstractCard.qml previously). Changed because a template should be without any layouts, etc (it should only represent a "building block")
    • Card: removed hiddenActions (already deprecated), better radius checks (probably tested on all corner cases), updated doc for new BannerImage.qml
    • CardsGridView: calculate cell size from card size (easier for users because the base is card size), allow users to set maximum card size, width to height multiplier (to calculate card height), allow users to set (horizontal and vertical) spacing
    • CardsLayout: set fillWidth & fillHeight, _cardsLayout (tell card that it is in a CardsLayout to properly function) to true on each child, Component.onCompleted should be at the end

[EDIT] This MR became cluttered with commits and mistakes. I will make a second attempt at reworking CardsLayout and AbstractCard.

Edited by Matej Starc

Merge request reports