Unsolved Directory-selection file dialog looks odd on Mac
-
Our project files are a directory, so we want a directory-selection dialog for Windows/Mac.
It works but on Mac it doesn't look that intuitive:
You can still see files in the folder but they are disabled. I'm not an expert Mac user so maybe this is just how it works on Mac, but the Windows version is just a bit neater:
Is there some other flag we should use or is this just how it is?
-
- Do you use
QFileDialog::ShowDirsOnly
orQFileDialog::DirectoryOnly
? - Do you use
QFileDialog::DontUseNativeDialog
? - Do you use http://doc.qt.io/qt-5/qfiledialog.html#getExistingDirectory ?
Don't forget:
On Windows and macOS, this static function will use the native file dialog and not a QFileDialog. However, the native Windows file dialog does not support displaying files in the directory chooser. You need to pass DontUseNativeDialog to display files using a QFileDialog.
In effect, I think you want what Windows gives you, you need one of those "directory only" flags for MacOS?
- Do you use
-
Hi,
Even if that looks unintuitive for you, it's the style of macOS's Finder. You can change how the files are shown by clicking the other two buttons on the left of the one that is active in your picture.
-
@jdxjohn
That it the native Mac dialog and that is how it is. Unlike windows it shows the file types you want to select (filters) darker and selectable, others lighter and non-selectable.
As you say it is rather un-intuitive compared to how windows does it. -
@JonB we definitely use the native dlgs - we had a custom one but it just wasn't right.
We use
qt.QFileDialog.ShowDirsOnly
Have I correctly understood that there's just no way to make a native Mac directory-picking dialog not show files? i.e. the flag I'm passing is ignored on Mac?
If it insists on showing the files I might as well show our internal project file as selectable as well, and grey out the others - right now users know MRML is the file they previously had to go searching around for so when they see an MRML file some are trying to open that rather than the enclosing directory.
As a side question, can I trivially turn a regular directory into some kind of archive on Mac (and I suppose windows) the way an application package does it, perhaps?