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. CSS for a QComboBox
Forum Updated to NodeBB v4.3 + New Features

CSS for a QComboBox

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 6.0k 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.
  • S Offline
    S Offline
    SteveKing
    wrote on last edited by
    #1

    Hi,

    I'm trying to style a QComboBox so that the items in the drop down have bigger spaces between them. This is for a touch screen application, the extra space is required so that the touch hits the right item. I've tried:

    @QComboBox
    {
    font: 16pt "MS Shell Dlg 2";
    }

    QComboBox QAbstractItemView::item
    {
    min-height:50px;
    }@

    But this doesn't seem to have any affect. After some googling I've found some posts that describe this same problem but they're for older versions of QT.

    Any ideas?

    Thanks,

    Steve

    1 Reply Last reply
    0
    • ? This user is from outside of this forum
      ? This user is from outside of this forum
      Guest
      wrote on last edited by
      #2

      did you try any other style options with

      @
      QCombobox QAbstractItemView::item
      @

      and did anything work?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SteveKing
        wrote on last edited by
        #3

        Hi,

        I've tried color, border and background and none of those work, which is telling me something I guess!

        Using:

        @QAbstractItemView
        {
        color: green;
        } @

        does change the colour of all the items in the drop down to be green, but it seems that there's no way to style the individual items.

        1 Reply Last reply
        0
        • ? This user is from outside of this forum
          ? This user is from outside of this forum
          Guest
          wrote on last edited by
          #4

          by default, looks like no. Probably you might have to extend QCombobo and build in this capability

          1 Reply Last reply
          0
          • S Offline
            S Offline
            stukdev
            wrote on last edited by
            #5

            [[blank-post-content-placeholder]]

            1 Reply Last reply
            0
            • ? This user is from outside of this forum
              ? This user is from outside of this forum
              Guest
              wrote on last edited by
              #6

              hi stuk,

              this stylesheet, only modifies the height of the combobox itself, the individual item height in the popup is still defined by the font size. Not sure if we can set some margin for the font itself have to chk that :)

              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