[Interest] QWidget style change and reverting it back

Thiago Macieira thiago.macieira at intel.com
Wed Feb 10 00:19:39 CET 2016


On terça-feira, 9 de fevereiro de 2016 10:12:37 PST Adam Light wrote:
> For what it's worth, I have always interpreted the following excerpt from
> http://doc.qt.io/qt-5/qwidget.html#palette-prop as implying that in a
> situation like this, setting the style sheet is the "right" thing to do:
> 
>  "The current style, which is used to render the content of all standard Qt
> widgets, is free to choose colors and brushes from the widget palette, or
> in some cases, to ignore the palette (partially, or completely). In
> particular, certain styles like GTK style, Mac style, Windows XP, and Vista
> style, depend on third party APIs to render the content of widgets, and
> these styles typically do not follow the palette. Because of this,
> assigning roles to a widget's palette is not guaranteed to change the
> appearance of the widget. Instead, you may choose to apply a styleSheet.
> You can refer to our Knowledge Base article here for more information."

And now you know why. In order to set the colour, it stops using the actual 
widget style and falls back to QWindowsStyle.

That has other consequences.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list