PDA

View Full Version : How to get childwidget to appear below parent widget?



Pembar
11th May 2009, 10:46
Hey guys,

I created a parent widget using the mainwindow class and I have a separate widget which I would like to use as a "child widget". When I call the function "show()" on the childwidget, it always appears above the parent widget, is there anyway to have it appear below the parent widget? Thank you.

I've tried to "lower()" the childwidget, but it just makes both windows "disappear", and it doesn't solve the problem. "raise()" on the parent widget doesn't seem to work either.

From my understanding "stackunder()" only works on siblig widgets, not parent -child widgets.

Regards,
Pembar

Lykurg
11th May 2009, 10:56
"child widget"? I don't understand.


if you want a separate window use QDialog (modular or non modular)
if you want to layout different widgets, buttons etc. inside a main window use QLayout (QHBoxLayout...)

Pembar
11th May 2009, 11:01
"child widget" was declared as a separate window - QDialog.

When I get the QDialog to "show()", it appears on top of the mainwindow, I want it to appear below.

Thanks

Lykurg
11th May 2009, 11:04
then use the move() function to move the dialog accorrding to the parents::pos()...

Pembar
11th May 2009, 11:06
I can move it around, no problem. But it seems to always overlap the parent window. I'd like the parent window (mainwindow) to always appear above the child window (QDialog).

Lykurg
11th May 2009, 11:13
I can move it around, no problem. But it seems to always overlap the parent window. I'd like the parent window (mainwindow) to always appear above the child window (QDialog).

Ah, ok, now I get you. Sorry took a time. If the dialog is not modular a parent::setFocus() should do the trick.

Lykurg
12th May 2009, 10:23
Ah, ok, now I get you. Sorry took a time. If the dialog is not modular a parent::setFocus() should do the trick.
EDIT: No it doesn't...
EDIT 2: ...and this wasn't the edit button:o
EDIT 3: Answer to your question: it is not possible

wysota
14th May 2009, 01:37
A child window (dialog) is always above its parent. If you want another stack order, don't pass a parent to the dialog (of course then you won't be able to make the dialog modal to the other window).