[Qt-interest] QLineEdit background same as QFrame

Neel Basu neel.basu.z at gmail.com
Mon May 18 20:55:31 CEST 2009


On Tuesday 19 May 2009 00:15:52 Ben Swerts wrote:
> Hi Neel,
>
> You need to set QPalette::Base instead of QPalette::Window. Just try it out
> in Designer. That way you can see the effect immediately.
>
> Greets,
> 	Ben

Thanks for your reply.

I tried it programatically 
ui->toEdit->setBackgroundRole(QPalette::Base);
and It didn't work.

I didn't find anything like backgroundRole in designer

Neel

> > I've a QFrame and in that I've a QLIneEdit
> > default background color of QLineEdit is white
> > but I want to make its background color the default background color of
> > the
> > window.
> > I've tried the following things but none of them worked.
> > ui->toEdit->setBackgroundRole(QPalette::Window);
> >
> >
> > ui->toEdit->setStyleSheet("background-color: "+QVariant(ui->toEdit-
> >
> > >palette().brush(QPalette::Window)).toString());
> >
> > They did not work. background color of the QLineEdit is still white
> >
> > any idea ??
> >
> > Thanks
> > Neel
>




More information about the Qt-interest-old mailing list