[Qt-interest] QLineEdit background same as QFrame
Ben Swerts
benswerts at telenet.be
Mon May 18 22:50:29 CEST 2009
> > 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
>
Hi Neel,
That's because you need to change the palette, not the background role.
That's accomplished with the setPalette function, something like (untested):
QPalette p = ui->toEdit->palette();
p.setBrush( QPalette::Base, p.window() );
ui->toEdit->setPalette( p );
But it's much easier in Designer by changing the palette (palette property
of QWidget)
Greets,
Ben
More information about the Qt-interest-old
mailing list