Results 1 to 4 of 4

Thread: Window focus question

  1. #1
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Window focus question

    Researching my books and can't find an answer....

    When I call a dialog from a menu selection, it appears in front of the main window, but when I call it directly from a function, it appears behind the main window.

    The question is, how to insure it will appear in front of the main window when called from a function?

  2. #2
    Join Date
    Oct 2009
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Window focus question

    May be you can explicitly specify the z-value of your dialog

  3. #3
    Join Date
    Oct 2009
    Posts
    22
    Thanks
    8
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Talking Re: Window focus question

    when you create the dialog,you must give it a parent。like this:
    QMessageBox msbox(mainform);

    the message box will show at center of mainform.

  4. #4
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Window focus question

    Just for those who might experience the same problem...

    The difficulty was that the dialog was actually launching before the main window because of where the call to it was - in mainwindow.cpp

    After moving the call to main.cpp, after the mainwindow was shown, no problem. It shows up on top.

Similar Threads

  1. Replies: 2
    Last Post: 9th August 2009, 22:08
  2. Window focus issues (How to force focus to a window?)
    By montylee in forum Qt Programming
    Replies: 3
    Last Post: 25th April 2009, 01:00
  3. QGLWidget window redrawing contents when losing focus
    By Barry79 in forum Qt Programming
    Replies: 1
    Last Post: 3rd April 2009, 13:37
  4. correct event for lose focus in a QGLWidget window
    By john_god in forum Qt Programming
    Replies: 4
    Last Post: 16th February 2009, 01:34
  5. Replies: 5
    Last Post: 4th August 2006, 23:44

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.