DIALOG:

Extract from the constructor of dialog:

Qt Code:
  1. setWindowFlags(Qt::WindowTitleHint | Qt::Dialog | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint);
  2. setModal(false);
To copy to clipboard, switch view to plain text mode 

cpp:
Qt Code:
  1. void FindDialog::closeEvent(QCloseEvent *e)
  2. {
  3. emit closing(true);
  4. QDialog::closeEvent(e);
  5. }
To copy to clipboard, switch view to plain text mode 

h:
Qt Code:
  1. protected:
  2. void closeEvent(QCloseEvent *e);
  3.  
  4. signals:
  5. void closing(bool visible);
To copy to clipboard, switch view to plain text mode 

MAIN WINDOW:

cpp:
Qt Code:
  1. findDialog = new FindDialog;
  2. findDialog->setVisible(false);
  3. findDialog->setMeasurements(&measurements);
  4. connect(findDialog, SIGNAL(closing(bool)), this, SLOT(setShown(bool)));
To copy to clipboard, switch view to plain text mode 

h:
Qt Code:
  1. FindDialog *findDialog;
To copy to clipboard, switch view to plain text mode 

Even if I change setShown to setFocus it doesn't make any difference.
How could I get back the focus to main window? It is crucial if user meanwhile activated a different application and then clicked back on dialog and closes it...

findDialog->setVisible(true); is called when a menu item is triggered.