Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Style QComboBox popup on Mac OSX



  • I got some issues with styling the combobox popup of Qt5 in Mac OSX

    my Stylesheet for QComboBox

    QComboBox {
        height: 16px;
        padding: 1px 5px 1px 5px;
        border: 2px groove #4B4F4F;
        border-bottom: 2px ridge #424545;
        border-right: 2px ridge #424545;
        border-radius: 3px;
        color: #DEDEDE;
        background: qlineargradient(x1:0, x2:0, y1:0, y2:1, stop:0 #6B6E6E, stop:1 #595B5B);
    }
    QComboBox::drop-down {
        subcontrol-origin: padding;
        subcontrol-position: top right;
        width: 14px;
        border-left-width: 1px;
        border-left-color: #999999;
        border-left-style: solid; /* just a single line */
        border-top-right-radius: 3px; /* same radius as the QComboBox */
        border-bottom-right-radius: 3px;
    }
    QComboBox::down-arrow {
        height: 8px;
        width: 8px;
        image: url(:/resources/images/downarrow.png);
    }
    QComboBox:on {
        border: 1px solid #00A7CC;
        padding-left: 6px;
    }
    QComboBox QAbstractItemView {
        min-width: 100px;
        outline: 1px solid #808A8A;
        border: 1px solid #373838;
        selection-background-color: #808A8A;
        background-color: #4A4C4F;
    }
    QComboBox:!enabled {
        color: #909090;
    }
    

    The result looks like this on Mac OSX:

    The following things that i would like to change:

    • Get rid of the white space on the top and bottom of the popup
    • Hide the tick on the left or change the size of it

Log in to reply