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. ListWidgetItem and Icon

ListWidgetItem and Icon

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 1.5k 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.
  • D Offline
    D Offline
    DivyPrakash
    wrote on last edited by
    #1

    I have a list widget to which i add listWidgetItems to it.The list widget item has text on the left and an icon on the right.When there is no icon the text has some spacing between the margin of list widget but when i add icon to it this spacing is gone.I set the text alignment as Qt::AlignLeft | Qt::AlignVCenter | Qt::AlignAbsolute .
    Any suggestions?

    1 Reply Last reply
    0
    • IamSumitI Offline
      IamSumitI Offline
      IamSumit
      wrote on last edited by
      #2

      Hi DivyaPrakash.
      Welcome on Qt Dev forum

      First of all you should clear your question ..What you want to achieve?

      Second thing is as you mentioned that text on left and icon on right is wrong it happens to be in reverse order(by default).

      if you want spacing b/w icon and text then you can add some space character(s)
      before text.

      Hope this would help.
      [Edit by IamSumit ]

      Be Cute

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        Well, the order would depend on the settings of Qt. It can run in right-to-left mode when needed for some languages.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DivyPrakash
          wrote on last edited by
          #4

          @IamSummit ...I want a consistent behavior meaning even when there is a icon, still there should be some spacing between the list widget and list widget item.
          http://postimg.org/image/rffa27j1z/

          See the screen shot the text starting with B does not have a icon to it.
          But the text starting with A has a icon to it,but for some reason after adding the icon the text gets shifted towards left.

          I made it reverse intentionally.

          1 Reply Last reply
          0
          • D Offline
            D Offline
            DivyPrakash
            wrote on last edited by
            #5

            @IamSummit ...I want a consistent behavior meaning even when there is a icon, still there should be some spacing between the list widget and list widget item.

            I made it reverse intentionally.Also this strange behavior is also present on Mac

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #6

              I see three options:

              • Put the icon in a column of its own
              • Always put an icon, even if it is just a 100% transparent png of the same size as your other icons
              • Implement your own delegate for the rendering
              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