summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2023-06-29 17:55:19 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2023-06-30 12:05:18 +0000
commitbc648641209ff598687ae9bcf88cd40d8aaf8847 (patch)
tree79f5cd0388ae5cee8aba116987be0b2d5eae1786 /src/plugins/platforms/cocoa
parent90345459fce8ae9ca58ca2279ea50129ad14e287 (diff)
macOS: Respect QDir::Hidden for native file dialogs
The default for showsHiddenFiles is NO, so we were not showing hidden files unless the user toggled them via the keyboard shortcut. Pick-to: 6.5 6.6 Change-Id: I796144452cf8f5a6cc46f1ba6747affcd0a35879 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
index b53235a0f1..1b414d0771 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
@@ -243,8 +243,12 @@ typedef QSharedPointer<QFileDialogOptions> SharedPointerFileDialogOptions;
return NO;
}
- if (!(filter & QDir::Hidden) && fileInfo.isHidden())
- return NO;
+ // We control the visibility of hidden files via the showsHiddenFiles
+ // property on the panel, based on QDir::Hidden being set. But the user
+ // can also toggle this via the Command+Shift+. keyboard shortcut,
+ // in which case they have explicitly requested to show hidden files,
+ // and we should enable them even if QDir::Hidden was not set. In
+ // effect, we don't need to filter on QDir::Hidden here.
return YES;
}
@@ -350,6 +354,8 @@ typedef QSharedPointer<QFileDialogOptions> SharedPointerFileDialogOptions;
if (m_panel.allowedFileTypes.count > 2)
m_panel.extensionHidden = NO;
+ m_panel.showsHiddenFiles = m_options->filter().testFlag(QDir::Hidden);
+
if (m_panel.visible)
[m_panel validateVisibleColumns];
}