CSS for a QComboBox



  • 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



  • did you try any other style options with

    @
    QCombobox QAbstractItemView::item
    @

    and did anything work?



  • 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.



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



  • [[blank-post-content-placeholder]]



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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.