Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 6

Qt-interest Archive, October 2007
Is it possible to completely overridde the QWindowsXPStyle palette?


Message 1 in thread

Is it possible to completely override the QWindowsXPStyle palette?

I have a test app where I assign (strong and obvious) colors to the
various color roles so I can clearly see exactly what parts of what
widgets are handled by a particular color role.  For example, the
test palette I am using is:
    testPalette.setCurrentColorGroup(QPalette::Active);
    testPalette.setColor(QPalette::Window, Qt::red);
    testPalette.setColor(QPalette::WindowText, Qt::green);
    testPalette.setColor(QPalette::Base, Qt::gray);
    testPalette.setColor(QPalette::AlternateBase, Qt::darkCyan);
    testPalette.setColor(QPalette::Text, Qt::yellow);
    testPalette.setColor(QPalette::Button, Qt::magenta);
    testPalette.setColor(QPalette::ButtonText, Qt::white);
    testPalette.setColor(QPalette::Highlight, Qt::darkGreen);
    testPalette.setColor(QPalette::HighlightedText, Qt::blue);

When (on WindowsXP) I use any style *except* QWindowsXPStyle, all of my
specified colors are used.  But with QWindowsXPStyle, my specified
colors
are ignored in a bunch of places.  Is this because the WindowsXP style
is
using native windows widgets/controls?  Is there any way to force it to
use specified colots?

--
 [ signature omitted ] 

Message 2 in thread

Richard Carreiro schrub:
> Is it possible to completely override the QWindowsXPStyle palette?

Nonono! As I have written in a previous post you *really* have to use 
the Qt style sheet mechanism! Forget about QPalette and setting the 
background colour: It does *not* work (as you have already found out)!

Really, you want to learn about Qt Style Sheets, read this:

   http://doc.trolltech.com/4.3/stylesheet.html

Cheers, Oliver

p.s. Qt Style Sheets != Qt Styles (aka themes) !!!

--
 [ signature omitted ] 

Message 3 in thread

> Richard Carreiro schrub:
> > Is it possible to completely override the QWindowsXPStyle palette?
> 
> Nonono! As I have written in a previous post you *really* have to use 
> the Qt style sheet mechanism! Forget about QPalette and setting the 
> background colour: It does *not* work (as you have already found out)!
> 
> Really, you want to learn about Qt Style Sheets, read this:
> 
>    http://doc.trolltech.com/4.3/stylesheet.html

That's not an option, unfortunately.  This is Qt 4.1.x.
Upgrading to 4.2 or 4.3 would be nice, but that's not in the cards for
this version of our product.  I'll definitely keep in mind what you 
say for when we do upgrade to 4.3 or 4.4 later on, though.

== Rich

--
 [ signature omitted ] 

Message 4 in thread

The XP style is pixmap based, and the pixmap provided by the system 
defines both form and color of the controls. You can't change one without 
changing the other as well.

Don't use the XP style, and use QWidget::setStyle or 
QApplication::setStyle to set a style that can honour the palette.


Volker

"Richard Carreiro" <RCarreiro@xxxxxxxx> wrote in message 
news:314ED8D74B191A4D91A9B9CB92EC6864010B0074@xxxxxxxxxxxxxxxxxxx
Is it possible to completely override the QWindowsXPStyle palette?

I have a test app where I assign (strong and obvious) colors to the
various color roles so I can clearly see exactly what parts of what
widgets are handled by a particular color role.  For example, the
test palette I am using is:
    testPalette.setCurrentColorGroup(QPalette::Active);
    testPalette.setColor(QPalette::Window, Qt::red);
    testPalette.setColor(QPalette::WindowText, Qt::green);
    testPalette.setColor(QPalette::Base, Qt::gray);
    testPalette.setColor(QPalette::AlternateBase, Qt::darkCyan);
    testPalette.setColor(QPalette::Text, Qt::yellow);
    testPalette.setColor(QPalette::Button, Qt::magenta);
    testPalette.setColor(QPalette::ButtonText, Qt::white);
    testPalette.setColor(QPalette::Highlight, Qt::darkGreen);
    testPalette.setColor(QPalette::HighlightedText, Qt::blue);

When (on WindowsXP) I use any style *except* QWindowsXPStyle, all of my
specified colors are used.  But with QWindowsXPStyle, my specified
colors
are ignored in a bunch of places.  Is this because the WindowsXP style
is
using native windows widgets/controls?  Is there any way to force it to
use specified colots?

--
 [ signature omitted ]