Persistent favorites folder in Add Data GUI

Dropping a folder to the list of favorites is great:
image

But it would be even better if it persist after a restart, or at least that there is an option in general settings to set my favorites folders.

Another related option is to store the recent folders automatically like Paraview.

I suppose it’s a Qt behaviour, and Qt applications don’t have control of this.

Of the two directories I add this way, one almost always survives a restart, not the other one. The former is added in during ‘Export to file system’ in the DICOM module, and the latter with ‘Import DICOM files’ functions. They visually look the same though.

Using current Slicer preview on Windows, clicking “Choose Directory to Add” brings up the Windows native file dialog so it remembers the last selected location and just overall easier to navigate to favorites/quick access locations from the Window File Explorer. This was as of Late June 2021 (ENH: Improve directory and file selection by using native dialogs · Slicer/Slicer@2c3bbb7 · GitHub). Not sure if you’re using current Slicer stable (4.11.20210226) which is older than that.

1 Like

I always use latest preview on Linux, built weekly.

The Qt file dialog could not keep up with improvements in native file dialogs (that are provided by the operating system). The Qt dialog has a few nice features, such as automatic conversion of path separator characters from \ to / on Windows and ability to add more file loading/saving options inside the dialog, but lacks integrated search, recently used places, networking, etc. features and overall does not look familiar to users. Therefore, we decided to switch to native file dialogs everywhere.

image

If you still see a Qt file dialog somewhere in a recent Slicer Preview Release then let us know. It might be a case where we rely on some special Qt filedialog features so we could not easily replace it with a native dialog, but maybe we just missed it.

Well, they are everywhere in KDE / Linux, with factory built and self built Slicer. I never see a KDialog like this one :

Screenshot_20220124_211535

It’s not a fundamental issue to me, just reporting.

1 Like

Thanks, it is good to know. Probably if Qt cannot access a native file dialog then it uses its own. Can you take a screenshot of the file dialogs that Slicer displays on your system?

Here is one :

Screenshot_20220124_221018

from ‘Import DICOM files’.

1 Like

Thanks @chir.set, @jamesobutler, @lassoan

I have never seen a native dialog in Linux from Slicer. I am using latest Linux with latest Gnome, and with any Slicer (4.11 stable, latest 4.13) I get the Qt file dialog (see my screenshot in the opener post).

I have been using Slicer in this computer since ages. Not sure if there is any system wide persistent cache folder that I should delete to start seeing native file dialogs.

QFileDialog documentation only mentions Windows and macOS related to native file dialog, which may indicate that linux may not be (well) supported. This discussion suggests that file dialogs of some linux distros and some Qt versions may be found depending on how Qt is built that is used for building Slicer.

The favorites could be probably saved by adding saveState/restoreState calls.

You can submit an issue for this (either trying to enable native file dialog on linux and/or saving state of the file dialog), but most likely it would not be worked on anytime soon, as its priority would be quite low compared to other fixes and improvements.

1 Like

Thanks @lassoan, I wonder how other OSes are able to see the native file dialog when CTK has this option enabled for Qt>=5: CTK/ctkFileDialog.cpp at 88d954ff72676c96002134de379a92fb8551f476 ¡ commontk/CTK ¡ GitHub

The switch to native dialogs happened in this commit: