Important: Please read the Qt Code of Conduct -

QComboBox and QAbstractSpinBox custom stylesheet affects arrow buttons

  • Hello
    I want to remove the gradient from these widgets to give them a "flat look" using custom stylesheet but it messes up the arrow buttons shape.
    first if want to do this to a QPushButton I have to change the color and the border style also, if I edit the color only the gradient effect will still appear

                         border-style : solid;
                         border-radius : 3px;
                         border-width : 0.8px;
                         border-color : white;
                         color : black;

    original look
    original look , you can see the gradient and the popped up feel.
    now, if I apply the same css to a QComboBox and QAbstractSpinBox the shape will look like this.
    after css
    after css
    intended look except for the color
    intended look except for the color

    I searched online for solutions and I found this in qtcentre forms and found this

    pushButton->setStyleSheet("background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 white, stop: 1 white);");

    if i apply this to the combobox it will appear completely black on "fusion" style

    is there a way to give a flat look to these widgets without messing up the look of the arrow buttons ?