Results 1 to 7 of 7

Thread: mapTOGlobal

  1. #1
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default mapTOGlobal

    hi, in mainform.ui.h I do:
    Qt Code:
    1. QDialog work;
    2. work->show();
    3. work->move(this->mapToGlobal(QPoint(0,0)));
    To copy to clipboard, switch view to plain text mode 
    to put work on the application windows....but it appear always in the same point...why? thanks
    Regards

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: mapTOGlobal

    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().

  3. #3
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: mapTOGlobal

    sorry, I don't understand if I have to use other ways or if you said me the solution....
    Regards

  4. #4
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: mapTOGlobal

    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?
    Regards

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: mapTOGlobal

    Use some kind of event, either a custom one or a timer with 0 timeout.

  6. #6
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: mapTOGlobal

    ok but how do I put my dialog exactly on the center of my app? thanks
    Regards

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: mapTOGlobal

    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.