[Qt-interest] QApplication::setPalette loses some colors
Schimkowitsch Robert
Robert.Schimkowitsch at andritz.com
Wed Aug 31 17:04:32 CEST 2011
Spot on!
Thanks!
Robert Schimkowitsch
-----Original Message-----
From: qt-interest-bounces+robert.schimkowitsch=andritz.com at qt.nokia.com
[mailto:qt-interest-bounces+robert.schimkowitsch=andritz.com at qt.nokia.co
m] On Behalf Of Constantin Makshin
Sent: Wednesday, August 31, 2011 4:02 PM
To: Qt Interest
Subject: Re: [Qt-interest] QApplication::setPalette loses some colors
QApplication::setPalette() function documentation
(http://doc.qt.nokia.com/4.7/qapplication.html#setPalette) says "The
palette may be changed according to the current GUI style in
QStyle::polish()." which "Changes the palette according to style
specific requirements for color palettes (if any).".
So Qt is likely to work as intended and your problem may be caused by
the style you use.
On Wednesday, August 31, 2011 05:46:28 PM Schimkowitsch Robert wrote:
> I have an issue that setting the global application palette using
> QApplication::setPalette does not work for all colors.
>
> I prepare a QPalette with the colors I want to use in my application.
>
> The I call the following:
>
> qDebug() << "Old Window color"
> << QApplication::palette().color(QPalette::Window);
> qDebug() << "New Window color"
> << pal.color(QPalette::Window);
> qDebug() << "Old AlternateBase color"
> <<
QApplication::palette().color(QPalette::AlternateBase);
> qDebug() << "New AlternateBase color"
> << pal.color(QPalette::AlternateBase);
>
> QApplication::setPalette(pal);
>
> qDebug() << "after setPalette"
> << QApplication::palette().color(QPalette::Window);
> qDebug() << "after setPalette"
> <<
QApplication::palette().color(QPalette::AlternateBase);
>
> which outputs:
>
> Old Window color QColor(ARGB 1, 0.831373, 0.815686, 0.784314)
> New Window color QColor(ARGB 1, 0.196078, 0.196078, 0.196078)
> Old AlternateBase color QColor(ARGB 1, 0.909087, 0.909087, 0.909087)
> New AlternateBase color QColor(ARGB 1, 0.392157, 0.392157, 0.392157)
> after setPalette QColor(ARGB 1, 0.196078, 0.196078, 0.196078)
> after setPalette QColor(ARGB 1, 0, 0, 0)
>
> As you can see, the "Window" color role is OK, whereas the
AlternateBase
> is now black, not the color I specified.
>
> Why is that?
>
> Kind regards
>
> Robert Schimkowitsch
#####################################################################################
This message and any attachments are solely for the use of the intended recipients. They may contain privileged and/or confidential information or other information protected from disclosure. If you are not an intended recipient, you are hereby notified that you received this email in error and that any review, dissemination, distribution or copying of this email and any attachment is strictly prohibited. If you have received this email in error, please contact the sender and delete the message and any attachment from your system.
Thank You.
ANDRITZ HYDRO GmbH
Rechtsform/ Legal form: Gesellschaft mit beschrankter Haftung / Corporation
Firmensitz/ Registered seat: Wien
Firmenbuchgericht/ Court of registry: Handelsgericht Wien
Firmenbuchnummer/ Company registration: FN 61833 g
DVR: 0605077
UID-Nr.: ATU14756806
#####################################################################################
More information about the Qt-interest-old
mailing list