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

Philipp Kursawe phil.kursawe at gmail.com
Wed Nov 27 12:48:15 CET 2013


Well, I am not applying the style to the combobox itself, but to the apps
global stylesheet like this:

QComboBox.error {
  border:2px solid red;
}

And the combobox property is set like this:
combo->setProperty("class", "error");


On Wed, Nov 27, 2013 at 12:46 PM, Philipp Kursawe <phil.kursawe at gmail.com>wrote:

> That's what I already did. I am using the second variant.
>
>
> On Wed, Nov 27, 2013 at 12:07 PM, Nurmi J-P <jpnurmi at digia.com> wrote:
>
>>
>> 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
>>
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20131127/49c5173e/attachment.html>


More information about the Interest mailing list