[Qt-interest] Setting new Palette not working

Neel Basu neel.basu.z at gmail.com
Sat May 23 09:42:39 CEST 2009


On Friday 22 May 2009 20:42:18 Neel Basu wrote:
> 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

      BUMP      



More information about the Qt-interest-old mailing list