PDA

View Full Version : To Set the Position of the dialog



merry
19th December 2007, 13:13
Hi all

Working on Qt4.2 on my intel MAC

I am working on a dialog based application , Actually what I want is when I move the dialog here and there and then when i open another dialog that dialog should appear over it only.How Pls tell me quickly

Its urgent.....


Thanx:)

high_flyer
19th December 2007, 14:03
How Pls tell me quickly

Its urgent.....
I could never understand this appendage to posts...
What does it imply, that we read the post, and do: "mmm... I'll first wait a couple of hours before I'll post my answer to this one..."??

have a look at QWidget::setGeometry() (http://doc.trolltech.com/4.3/qwidget.html#geometry-prop)
and QWidget::move() (http://doc.trolltech.com/4.3/qwidget.html#pos-prop)

ntp
21st December 2007, 21:14
This may be too late but I do this to move a dialog directly underneath another dialog:



int resultsY = windowA->y() + windowA->frameGeometry().height();
int resultsX = windowA->x();
windowB->move(resultsX, resultsY);


You could probably just do:


windowB->move(windowA->x(), windowA->y());


to move it over the current dialog starting at the top left corner

It sounds like you have done this already but if anyone else is trying it, make sure you have down a show() on the dialogs first so that they are at their final position/size before moving them.

jpn
21st December 2007, 21:35
Let me add to that, that a QDialog with a parent is automatically centered on top of the parent's top-level widget.