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. QComboBox item height[Solved]
QtWS25 Last Chance

QComboBox item height[Solved]

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

    How do i give spacing in QComboBox items.

    Meaning if i want to increase the vertical gap between 2 items.

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      In the open list? You could use style sheet.
      Something like:

      StyleSheet:
      @
      QComboBox QAbstractItemView::item {
      margin-top: 2px;
      }
      @

      and set this style sheet on the combo box.

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • G Offline
        G Offline
        gauravofindia
        wrote on last edited by
        #3

        I want the gap between two lists items. Will the above style do that?

        1 Reply Last reply
        0
        • G Offline
          G Offline
          giesbert
          wrote on last edited by
          #4

          The above style issues an item of a QAbstractItemView inside a combo box, yes it will address the item. Whether margin is the correct property of the item, I'm not 100% sure, but I think it should do it. Try it out :-)

          Nokia Certified Qt Specialist.
          Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

          1 Reply Last reply
          0
          • G Offline
            G Offline
            gauravofindia
            wrote on last edited by
            #5

            Yes this works.

            1 Reply Last reply
            0
            • G Offline
              G Offline
              giesbert
              wrote on last edited by
              #6

              then you should mark this thread as solved:

              click edit on your first post and add [Solved] in the title :-)

              Nokia Certified Qt Specialist.
              Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

              1 Reply Last reply
              0
              • R Offline
                R Offline
                r2d3
                wrote on last edited by
                #7

                Hi all,

                I am also trying to access ::item of the ItemView of the QComboBox but

                QComboBox QAbstractItemView::item

                does not seems to work.

                I am using Qt 4.7.1 ... does someone successfully used ::item in this case ?

                Thanks in advance.

                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