PDA

View Full Version : Need to know widget size before first shown



durbrak
11th January 2007, 21:34
Hello,
I have a couple of dialogs which I need to position very directly. The problem is, that QWidget::height() etc. won't give me the real sizes unless QWidget::show() was called once.
I've looked through the doc and didn't seem to find some function which actually lays out all the widgets in the dialog before QWidget::show() is called.
My current workaround for this is:

this->show();
this->move(x, y);
But that is not nice since you can see the dialog for tiny time at some position at the screen and then in suddenly moves to my x- and y-coordinates. I don't like it :)
So, have I overlooked the function I need or is there maybe some other, nicer, workaround for this?
Thank you!

wysota
11th January 2007, 21:37
No, there is none. You can either try to guess the size based on the sizeHint() (but the window decoration will screw things up and furthermore you don't have any assurance the widget will have size equal to its hint) or use layouts to position the widget. If the standard ones don't suit your needs - implement your own.