QML ListView individual item spacing



  • 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!


  • Moderators

    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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.