[Qt-interest] Setting new Palette not working

Neel Basu neel.basu.z at gmail.com
Fri May 22 17:12:18 CEST 2009


Please See the Attached Image first
I've a QFrame that I am using like a SidePane. and I've set some StyleSheet on 
it
----- StyleSheet------------
background-color: qlineargradient(spread:pad, x1:0, y1:0.023, x2:1, y2:1, 
stop:0 rgba(70, 70, 70, 255), stop:1 rgba(112, 112, 112, 255));
color: rgb(255, 255, 255);
--------------------------------
and I've Placed some QToolButton(s) on that
But QToolButtons are also getting the same gradiant as Background.
What I am trying to do is make their background Transparent.
So that Just the buttons will stay. and the background of those Buttons will 
depend on the Color or the QFrame's Gradient on that position

Hope I am able to make you understand.

But I dont know How to do that. Any Idea ??

However I've also tried to set some fixed color on those QToolButtons just to 
see if they works. But it did not work.

Here goes the Code that I've used.
-----------------
QPalette p = ui->sideFrame->palette();
p.setColor(QPalette::Base, Qt::green);
p.setColor(QPalette::Window, Qt::green);
p.setColor(QPalette::Button, Qt::green);
p.setColor(QPalette::Background, Qt::green);
p.setColor(QPalette::Text, Qt::green);
p.setColor(QPalette::ButtonText, Qt::green);
p.setColor(QPalette::WindowText, Qt::green);
ui->inboxToolBtn->setAutoFillBackground(false);
ui->inboxToolBtn->setAttribute(Qt::WA_WindowPropagation, false);
ui->inboxToolBtn->setPalette(p);
ui->inboxToolBtn->repaint();
---------------
But that does NOTHING even if I call ui->inboxToolBtn->update() that does even 
nothing too.

Why ??

Thanks
Neel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SidePane.png
Type: image/png
Size: 19258 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090522/911da38c/attachment.png 


More information about the Qt-interest-old mailing list