Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] QListView : how align vertically icons of each item vertically
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.7k Views 1 Watching
  • 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.
  • F Offline
    F Offline
    floreal797
    wrote on last edited by
    #1

    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,

    Floréal.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • F Offline
        F Offline
        floreal797
        wrote on last edited by
        #3

        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!

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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 :)

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          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