PDA

View Full Version : Window Focus Problem



waynew
5th May 2010, 23:44
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):



MainWindow::close();
MainWindow::show();
MainWindow::activateWindow();
MainWindow::raise();
ui->mwCall->setFocus();


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?

waynew
6th May 2010, 13:34
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.