Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    QComboBox item height[Solved]

    General and Desktop
    3
    7
    15549
    Loading More Posts
    • 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
      gauravofindia last edited by

      How do i give spacing in QComboBox items.

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

      1 Reply Last reply Reply Quote 0
      • G
        giesbert last edited by

        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 Reply Quote 0
        • G
          gauravofindia last edited by

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

          1 Reply Last reply Reply Quote 0
          • G
            giesbert last edited by

            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 Reply Quote 0
            • G
              gauravofindia last edited by

              Yes this works.

              1 Reply Last reply Reply Quote 0
              • G
                giesbert last edited by

                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 Reply Quote 0
                • R
                  r2d3 last edited by

                  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 Reply Quote 0
                  • First post
                    Last post