Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.3.1
-
None
-
MacOS Monterey 12.5, XCode 13.4.1
Description
If I will create a FileDialog and set its currentFolder property, the dialog will navigate to it just on the first open. If I change that property between subsequent reopens the changes to this property are ignored on Mac (works fine on Windows). I am pretty sure it is not a new issue and I have seen that in the Qt 5.x series.
Quick temporary workaround is to patch the QQuickFileDialog as below, but I suspect it should be fixed in the Cocoa platform file dialog helper.
void QQuickFileDialog::setCurrentFolder(const QUrl ¤tFolder) { qCDebug(lcFileDialog) << "setCurrentFolder called with" << currentFolder; if (QPlatformFileDialogHelper *fileDialog = qobject_cast<QPlatformFileDialogHelper *>(handle())) { #if !defined(Q_OS_MACOS) fileDialog->setDirectory(currentFolder); #else if (isVisible()) { fileDialog->setDirectory(currentFolder); } else { // Recreate the native dialog to ensure that the new current folder is applied // as its changes seem to be ignored on subsequent reopens by Cocoa/QPlatform destroy(); } #endif } m_options->setInitialDirectory(currentFolder); }