From 922c87a3b8ab16b18b2f04c114f6d20ba12e4eb9 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Tue, 16 Sep 2014 13:39:25 +0200 Subject: OSX: make QFileDialog::getSaveFileName honor the initial file name. Since OSX 10.9 the NSSavePanel will call panelSelectionDidChange on the delegate when the selection is changed programmatically, even when the panel is not (yet) visible. This overwrites the selected file name with the default "Untitled" before we'd set it in runApplicationModalPanel. The fix is to check if panelSelectionDidChange is called before it is shown. Change-Id: I9ad6cd3afddc0aac35baebab31fd85cd7bf3f9e9 Task-number: QTBUG-36212 Reviewed-by: Gabriel de Dietrich --- src/gui/dialogs/qfiledialog_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm index da15a61..0ba4e4a 100644 --- a/src/gui/dialogs/qfiledialog_mac.mm +++ b/src/gui/dialogs/qfiledialog_mac.mm @@ -459,7 +459,7 @@ QT_USE_NAMESPACE - (void)panelSelectionDidChange:(id)sender { Q_UNUSED(sender); - if (mPriv) { + if (mPriv && [mSavePanel isVisible]) { QString selection = QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString([mSavePanel filename])); if (selection != mCurrentSelection) { *mCurrentSelection = selection; -- cgit v0.12