[Qt-interest] Problem with background-image + parent widget

Ferenc Stelcz ferenc at stelcz.hu
Sun May 24 13:06:09 CEST 2009


Tr3wory wrote:
> Hi!
> 
> In my previous letter, I made a mistake.
> So, In designer, everything is fine.
> 
> When I use this widget with or without parent,  it did not show the
> background image.
> 
> After that I set the palette of a widget, and autoFillBackground by
> hand like this:
> 
> QPalette p=palette();
> p.setBrush(QPalette::Window, QPixmap("background.png"));
> setPalette(p);
> setAutoFillBackground(true);
> 
> If I use my widget without parent, it works. When I use with parent,
> it do not work...
> 
> I don't understand at all...

It may be because your child widget inherits the parent's role which 
automatically overwrites your settings for the background. I did not dive into 
it, but you could try using style-sheets.


HTH

--
Ferenc Stelcz
Junior Software Engineer

Banyan Technologies LLC.


__________ Information from ESET Smart Security, version of virus signature database 4098 (20090522) __________

The message was checked by ESET Smart Security.

http://www.eset.com





More information about the Qt-interest-old mailing list