Important: Please read the Qt Code of Conduct -

[Solved] QListView : how align vertically icons of each item vertically

  • Hi,

    I am creating QListViews. Each item may have several lines because I have set the wrap word to true. But, by default the icon is aligned centered vertically.

    That I want to do is to put this icon at the top-left of each item, and not center-left like it is by default. How can I do that ?

    Thank you in advance for your help,


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    AFAIK, it's not possible with QListView alone. However you can use a QStyledItemDelegate to do that.

    Hope it helps

  • Hi,

    Thank you, I have tried to use it and it nearly works. I have only a little problem, I will open a new topic for it.

    Despit of that, alignment of the icon with QstyledItemDelegate works very well!

  • Lifetime Qt Champion

    You're welcome !

    Since you have it working, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

Log in to reply