PDA

View Full Version : mapTOGlobal



mickey
27th July 2006, 20:16
hi, in mainform.ui.h I do:


QDialog work;
work->show();
work->move(this->mapToGlobal(QPoint(0,0)));

to put work on the application windows....but it appear always in the same point...why? thanks

wysota
27th July 2006, 20:48
Probably because you move it before it is shown. show() doesn't work synchronically, it just posts an event to the event queue. So move() is executed before show().

mickey
27th July 2006, 21:28
sorry, I don't understand if I have to use other ways or if you said me the solution....

mickey
27th July 2006, 23:05
ok if I use work->exec(), the move work...but the program is stop there... I need it go on.....
work->show();
doSOmething
work->close();
Ho do I do?

wysota
27th July 2006, 23:18
Use some kind of event, either a custom one or a timer with 0 timeout.

mickey
27th July 2006, 23:52
ok but how do I put my dialog exactly on the center of my app? thanks

wysota
28th July 2006, 01:04
I am sorry mickey, but I won't answer that question. You have already asked more than a hundred questions on this forum and this question is a very basic one, so I suggest you really try to solve it yourself instead of asking on forums again and again. I think the availability of this site and the amount of help you already received caused you to stop learning, because someone solves every obstacle for you.

If you need help while solving the problem, we'll gladly help, but we (at least I) won't give you a solution to this particular problem -- you were given enough hints to start reading docs and experiment yourself (and not only in this thread).

After seeing your posts I take that you didn't read docs for QWidget::move(), you didn't read docs for QDialog::exec() (as you seem not to know why it behaves the way it behaves), you didn't read about and understand QWidget::show(), you don't actually know how Qt works (after having written half a thousand posts on this forum, not counting the ones on QtForum?), you didn't read about timers with 0 timeouts...

Tell me -- why? I know English is not your native language, but Qt docs are really easy to understand and Qt sources are available for reading... I suggest you take a look at QWidget::show() and QDialog::exec() implementations and you'll surely understand why your application behaves the way it behaves.

It is time we stop giving you fish and start giving you fishing poles, as you stopped making progress in learning Qt. It is time you moved on to reach "the next level of understanding" -- experiment, try... and then if you can't comprehend the situation, tell what have you already tried and ask for help.