PDA

View Full Version : How to show thw widget in center?



sudhansu
4th February 2010, 05:25
Hi All
i've a dialog of size 401,431. I want to display it in the centre of my screen. But its showing at different position in different systems. (may be because of the different resolution ). How to achive it.
in constructor, I did like


this->move(QApplication::desktop()->screenGeometry().center());

But its not working.
Plz help.

aamer4yu
4th February 2010, 05:38
What does center() return ??
You want your widget's top left corner to be on the center of screen ? Or you want the widgets center to be in the center of screen ?
Rest is all calculations :rolleyes:

sudhansu
4th February 2010, 06:38
What does center() return ??
You want your widget's top left corner to be on the center of screen ? Or you want the widgets center to be in the center of screen ?
Rest is all calculations :rolleyes:

Hi
I want to show it in the center of screen. (of my Desktop).

aamer4yu
4th February 2010, 06:51
So do you think
this->move(QApplication::desktop()->screenGeometry().center());
was proper calculation ?

Shouldnt it be something like screen().center() - widget.center() ??