[Qt-interest] QApplication::setPalette loses some colors

Schimkowitsch Robert Robert.Schimkowitsch at andritz.com
Wed Aug 31 15:46:28 CEST 2011


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
#####################################################################################

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110831/88d4aef9/attachment.html 


More information about the Qt-interest-old mailing list