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:
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user