SCIInstitute / SCIRun

SCIRun is a Problem Solving Environment, for modeling, simulation and visualization of scientific problems. This is version 5, the upgraded version of SCIRun v4.
http://scirun.org
Other
128 stars 72 forks source link

Linux: File Dialogs auto append extensions #2110

Open tarkpate opened 4 years ago

tarkpate commented 4 years ago

The file dialog function Qt uses to get the file name does not append the extension listed with the selected filter. Instead, it will save the file with no extension at all. We should implement this so the dialog matches the behavior of Mac and Windows.

This was reported 10 years ago in Qt's bug tracker. They fixed it for the non-native dialog in Qt4, but it's broken again in Qt5. I found 2 methods on their issue tracker that we could use. https://bugreports.qt.io/browse/QTBUG-11352 Say the user saves a matrix called 'A'. Currently it asks if we want to overwrite a current file named 'A', not 'A.mat'. Both these methods would give us control over appending the extension and allow us to create our own confirmation dialog.

Method 1. Disable confirming overwrites and call getSaveFileName(). Now we can append the extension in the application and give our confirmation dialog after checking for the existing filename. We continue if they choose to overwrite. If they choose not to overwrite, we can reopen the dialog.

Method 2. Don't use getSaveFileName(). We can use QFileDialog directly to set variables, execute the dialog, and get the selected name. We would append the extension if necessary and show a confirmation dialog.

While this isn't as critical for most dataIO modules since it saves as a file correctly even without an extension, saving a screenshot in ViewScene without .png doesn't save at all and gives no warning to the user.

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 240 days with no activity. Remove the stale label or comment, or this will be closed in 60 days.