Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML ListView individual item spacing
QtWS25 Last Chance

QML ListView individual item spacing

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 5.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Beacon11
    wrote on last edited by
    #1

    Hello.

    I have a ListView with Image delegates. The images can be different sizes, so to space images in the list evenly I was hoping perhaps I could have different spacings for each image depending on that image size.

    In other words, the ListView.spacing property doesn't work since it affects all delegates equally. Is there a way to specify spacing inside the delegates themselves? anchors.topMargin and the like don't seem to work.

    Thanks for your help!

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mlong
      wrote on last edited by
      #2

      You could make a plain Item (or Rectangle) as a delegate, with the Image as a child item of that item. Then you could adjust the height of the Item itself as needed while leaving your Image (or other contents of the item) their original size.

      Software Engineer
      My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved