PDA

View Full Version : How to Create child widget behind parent widget?



anupamgee
12th May 2009, 09:21
hi all,
I want to create a child widget behind parent widget .How to do this.

wysota
12th May 2009, 09:39
You can't. The child is always on top of its parent. You can only mix sibling widgets. But what is your usecase? It's very unlikely that you do need to place one widget behind the other.

anupamgee
12th May 2009, 09:57
thanx for reply
Can u explain how i can place siblings behind one another.I tried stackUnder(QWidget *);

wysota
12th May 2009, 20:53
This is not something you can really control and I would advise against trying and instead tell us what you are trying to do and we will think of a better solution.

netmat
14th June 2010, 14:59
hi wysota and all,

is it the standard behavior of Qt that the parent widget will be displayed always below the child, if they are overlapped?

In my app, i have a control bar widget which is the parent to all other widgets. When the control bar overlapped with any other widget it is being displayed under that widget. But I need to display the control bar on top of children if its clicked and children on top if they are clicked.

How that can be achieved?

Thanks in advance!

wysota
14th June 2010, 15:04
is it the standard behavior of Qt that the parent widget will be displayed always below the child, if they are overlapped?
Child widget is always on top of its parent and can't extend past the area occupied by its parent (so they always "overlap").

netmat
22nd June 2010, 14:03
in my case both widgets are window and normally they don't overlap unless you put one over another.
i have made the "control bar" parent by calling setParent(this, Qt::Window) on it.

how can i make the z-order normal so that the control bar (parent) will not stay always behind the child widget?

edit:
I got the answer here. (http://www.qtcentre.org/threads/20904-How-to-get-childwidget-to-appear-below-parent-widget)