PDA

View Full Version : How to set a widget as background?



Patrick Sorcery
25th October 2010, 07:51
What I need is:

1 the background widget should resize with window automatically
2 I need to put some other witgets on(I mean over or cover) the background one

the straightest way of 1 is using form layout, but then everything is in the layout and I can't put any wighets on others. So is there anything to do it?

Thanx a lot!

high_flyer
25th October 2010, 09:30
I am not sure I follow.
What (usability) sense does it make to put widgets as background (meaning you can't see them or only partly)?
Can you give a user case example to what you need?
It sounds like you are trying to solve a problem in the wrong way...

Patrick Sorcery
25th October 2010, 10:08
Mmm... sorry for not expressing clearly. here I explain again

I just want one widget to fill almost the whole area of the form which seems like a 'background', while other widgets are all 'on' it. Of course the 'background' widget can be seen only partly. It happens when I use QVTKWidget to represent a chemical reactor, and want to add some 'clock' widget over the view of the reactor. I'm not sure if it's more clear.

high_flyer
25th October 2010, 10:29
Do you mean placing child widgets on top of parent widget?
If this is what you mean, what is the problem exactly doing that?

Patrick Sorcery
25th October 2010, 11:03
I don't think so... I mean that I want to put a smaller widget in front of a larger one, and the larger one should fill the whole form... no other relationship between them...

high_flyer
25th October 2010, 11:43
Well, then just create the "top" widget to be a child of your form (like your "background" widget) and set its Z order to be in front of your "background" widget, and don't place it in a layout, rather position it manually.

Patrick Sorcery
25th October 2010, 12:24
mmm... so how could I set the background widget to resize automatically with the form through manually size settings?

wysota
25th October 2010, 12:41
Reimplement resizeEvent() for the top-level widget or put the background widget in a layout. In general I think you are trying to do something terribly wrong here. I think your "background" should be your "foreground" and your "foreground" should be a child widget (or child widgets) of your "background".