Regain focus after native file dialogs have been closed.

For some reason this happens on Mac OS X.
We work around it by calling activateWindow().

Closes #39
This commit is contained in:
Felix Geyer
2012-07-23 23:58:46 +02:00
parent c0e91e4f16
commit 5786d0c279
3 changed files with 13 additions and 5 deletions

View File

@@ -38,6 +38,11 @@ QString FileDialog::getOpenFileName(QWidget* parent, const QString& caption, QSt
QString result = QFileDialog::getOpenFileName(parent, caption, dir, filter,
selectedFilter, options);
// on Mac OS X the focus is lost after closing the native dialog
if (parent) {
parent->activateWindow();
}
if (!result.isEmpty()) {
config()->set("LastDir", QFileInfo(result).absolutePath());
}
@@ -63,6 +68,11 @@ QString FileDialog::getSaveFileName(QWidget* parent, const QString& caption, QSt
QString result = QFileDialog::getSaveFileName(parent, caption, dir, filter,
selectedFilter, options);
// on Mac OS X the focus is lost after closing the native dialog
if (parent) {
parent->activateWindow();
}
if (!result.isEmpty()) {
config()->set("LastDir", QFileInfo(result).absolutePath());
}