This should be simple, but I can't get it to work right.
I have two display objects for some database data, one a table view and one a dialog.
The table view shows multiple records and the dialog shows a single record view.
Depending on saved preferences, one or the other opens on application start up.
If the table view opens, the focus returns to the main window. If the dialog opens, the focus stays on the dialog, not the main window. The dialog is non-modal.
There is a pushbutton on the main window to switch between the two displays.
If you switch to the table view, the focus returns to the main window, if you switch to the dialog, the focus stays on the dialog. I have added the following code both on application start up and on display switching to try and force the focus back to the main window after the dialog opens, but it isn't doing it.

Any suggestions?

Qt Code:
  1. MainWindow::close();
  2. MainWindow::show();
To copy to clipboard, switch view to plain text mode