Results 1 to 4 of 4

Thread: How to popup QDialog at specific location?

  1. #1
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How to popup QDialog at specific location?

    Hi,

    I have a QDialog with QMainWindow as parent, I try to popup the dialog at a specific location using move() right before calling exec(), but it always popup at the center of the QMainWindow.

    How can I change the QDialog default popup location?

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Boston, MA
    Posts
    40
    Thanks
    1
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to popup QDialog at specific location?

    It does work for me(4.3.0). The only difference is my dialog is modeless.

    Example:
    progressDialog->move(x, y);
    progressDialog->show();
    progressDialog->raise();

  3. #3
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to popup QDialog at specific location?

    Quote Originally Posted by fanat9 View Post
    It does work for me(4.3.0). The only difference is my dialog is modeless.

    Example:
    progressDialog->move(x, y);
    progressDialog->show();
    progressDialog->raise();
    I am using both Qt4.3.2 and Qt4.5 beta in Linux, and I need a modal dialog by doing:

    dialog->move( p );
    dialog->exec();

    Neither Qt version works for me. QDialog is always in the center of the QMainWindow (the parent)

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to popup QDialog at specific location?

    From QDialog docs:
    Note that QDialog (an any other widget that has type Qt::Dialog) uses the parent widget slightly differently from other classes in Qt. A dialog is always a top-level widget, but if it has a parent, its default location is centered on top of the parent's top-level widget (if it is not top-level itself). It will also share the parent's taskbar entry.
    J-P Nurmi

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.