[Interest] QWidget style change and reverting it back
Adam Light
aclight at gmail.com
Tue Feb 9 19:12:37 CET 2016
On Tue, Feb 9, 2016 at 7:47 AM, Thiago Macieira <thiago.macieira at intel.com>
wrote:
> On terça-feira, 9 de fevereiro de 2016 18:31:54 PST Prav wrote:
> > I am trying to change color of QLineEdit with
> >
> > ui->lineEdit->setStyleSheet("color: red;");
>
> Why didn't you just set the colour, by changing the widget's palette?
>
>
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."
The linked Knowledge Base article is a dead link.
Adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160209/ed09c785/attachment.html>
More information about the Interest
mailing list