Results 1 to 2 of 2

Thread: Window Focus Problem

  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 Problem

    I have a main window, a table view, and a dialog window.
    When the program shows the view, the focus stays on the main window - this is the desired behavior. When the program shows the dialog, the focus switches to the dialog - not desired behavior in my case.
    I have tried the following lines to try and force the focus back to the main window when switching displays back and forth between the table view and the dialog (they are just different presentations of the same data and only one of them is shown at the same time):

    Qt Code:
    1. MainWindow::close();
    2. MainWindow::show();
    3. MainWindow::activateWindow();
    4. MainWindow::raise();
    5. ui->mwCall->setFocus();
    To copy to clipboard, switch view to plain text mode 

    No luck, focus always switches to the dialog when it is shown.
    Dialog form focusPolicy is set to NoFocus and dialog is non-modal.

    Any ideas as to what to try now? What am I missing?

  2. #2
    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 Problem

    It wasn't the program - it was the Windows mouse pointer setting that sent the cursor to the button on the dialog whenever it opened, giving the dialog focus.
    Turning off that Windows mouse setting solves the problem.

Similar Threads

  1. Window focus question
    By waynew in forum Newbie
    Replies: 3
    Last Post: 31st October 2009, 23:11
  2. How to show window without stealing focus?
    By piotr.dobrogost in forum Qt Programming
    Replies: 2
    Last Post: 9th June 2009, 06:26
  3. 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
  4. QGLWidget window redrawing contents when losing focus
    By Barry79 in forum Qt Programming
    Replies: 1
    Last Post: 3rd April 2009, 13:37
  5. 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

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.