[Interest] QSS/CSS styling a border on a combo removes styles from dropdown control

Nurmi J-P jpnurmi at digia.com
Wed Nov 27 12:07:15 CET 2013


On 27 Nov 2013, at 11:10, Philipp Kursawe <phil.kursawe at gmail.com> wrote:

> I wonder if that is a bug:
> If I style a QComboBox's border with a "2px solid red" it looses its style on the dropdown arrow, which happened to be flat styled (on Windows) and then appears in 3D beveled style like old Win95. No more styles have been applied to this combo via css.
> 
> Whats going on here?
> 
> Is there a way to bring back the "default" style (reset a style) on the dropdown sub-control?
> 

Try using selectors [*] to avoid applying the border to all children of QComboBox.

These two have very different results:

    comboBox1->setStyleSheet("border: 2px solid red;”);
    comboBox2->setStyleSheet("QComboBox { border: 2px solid red; }”);

[*] http://qt-project.org/doc/qt-5.1/qtwidgets/stylesheet-syntax.html#selector-types

--
J-P Nurmi




More information about the Interest mailing list