Skip to content

Added suffix handling for Qt SAVE file dialogs#1727

Open
wolfpackmars2 wants to merge 2 commits into
solvespace:masterfrom
wolfpackmars2:patch-4
Open

Added suffix handling for Qt SAVE file dialogs#1727
wolfpackmars2 wants to merge 2 commits into
solvespace:masterfrom
wolfpackmars2:patch-4

Conversation

@wolfpackmars2

Copy link
Copy Markdown
Contributor

Resolves #1689

Not much else to say, the code is straightforward and matches how guigtk.cpp handles file extensions as closely as possible.

This also fix how file extensions are handled for other export file types, like .stl etc.

I have functionally tested this in Ubuntu 24.04.

@phkahler

Copy link
Copy Markdown
Member

@wolfpackmars2 This looks much better than the last attempt. Simple and localized to the one file! Unfortunately my Linux box is still broken so I'll have to let someone else test this. I might just trust that you tested it enough since it's so simple and restricted to QT ;-)

@WickedSmoke can you give it a look, if not an actual build/test?

Comment thread src/platform/guiqt.cpp
public:
QFileDialog fileDialogQ;
QStringList filters;
QStringList defaultSuffixes;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no need to add new data members. I edited this patch to remove them on my qt-ext3 branch.

Comment thread src/platform/guiqt.cpp Outdated

// NOTE: The file extension is automatically set by the KDE native
// dialog but not with the Qt one.
// dialog and now with the Qt one.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a comment on the behavior of the platform dialogs, not about this class. I've updated the comment to include Gtk on my qt-ext3 change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a comment on the behavior of the platform dialogs, not about this class.

this was just a last minute "cheeky" edit.

I will get these tested sometime this week and then get this closed out if no concerns are identified. I'm sure it's fine, just haven't had a chance to look at it yet.

Thanks for reviewing this for me @WickedSmoke.

@wolfpackmars2

Copy link
Copy Markdown
Contributor Author

@WickedSmoke Without the defaultSuffixes and related code, the Qt dialog would not automatically add the file suffix, unless the user first modified the Filters combo box.

I did update the comments slightly.

Long story short, the edits in the qt-ext3 branch will force a file extension, when the user initiates the change in the dialog box, but it didn't set the "default" file suffixes.

I considered dropping the added bool, but using it didn't seem any less efficient than querying the .acceptMode of the dialog.

@ruevs

ruevs commented Jul 1, 2026

Copy link
Copy Markdown
Member

@WickedSmoke I tested your https://github.com/WickedSmoke/solvespace_qt5/ branch at commit 2efb82c with Qt5 on Windows and it works fine. The .slvs. extension is added. Of course with the #if 0 changed to #if 1.

My suggestion is to merge that branch into master and close this PR. @phkahler, @wolfpackmars2 what do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QT: Solvespace not appending .slvs file extension by default

4 participants