Results 1 to 5 of 5

Thread: Display QDialog in the monitor in which the application is launched

  1. #1
    Join Date
    Mar 2012
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Display QDialog in the monitor in which the application is launched

    I've multiple monitors attached to my computer. I want QDialog to be displayed in the monitor from which I launch the executable. Currently the QDialog is displayed randomly in any monitor(mostly in primary monitor).
    Is this possible to do?

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Display QDialog in the monitor in which the application is launched

    You can save the number of the monitor at start time, and then, when displaying the dialog, just ensure it is shown there.

  3. #3
    Join Date
    Mar 2012
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Display QDialog in the monitor in which the application is launched

    My code goes like this..

    Qt Code:
    1. QDesktopWidget * d = QApplication::desktop ();
    2. QRect r = d->screenGeometry(this);
    To copy to clipboard, switch view to plain text mode 
    In the QRect I'm getting the monitor size from which the executable is launched. But when the QDialog is displayed, sometimes it gets displayed in other screens. How to ensure that QDialog gets displayed in the same monitor.

  4. #4
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Display QDialog in the monitor in which the application is launched

    Read about QDesktopWidget

  5. #5
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Display QDialog in the monitor in which the application is launched


Similar Threads

  1. Replies: 6
    Last Post: 24th November 2011, 09:54
  2. How to read Monitor/display name
    By CSwanepoel in forum Newbie
    Replies: 2
    Last Post: 12th April 2011, 03:42
  3. Display QTreeView expanded in QDialog
    By LynneV in forum Qt Programming
    Replies: 3
    Last Post: 21st December 2010, 20:32
  4. Display QDialog on Top of all.
    By sudhansu in forum Qt Programming
    Replies: 6
    Last Post: 22nd April 2010, 08:42
  5. display informations of QDirModel on QDialog
    By hbill in forum Qt Programming
    Replies: 1
    Last Post: 10th April 2008, 21:36

Tags for this Thread

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.