Qt QFileDialog - native dialogs only with static functions?

Posted by darron on Stack Overflow See other posts from Stack Overflow or by darron
Published on 2010-04-09T16:27:43Z Indexed on 2010/04/09 17:23 UTC
Read the original article Hit count: 391

Filed under:
|
|

I'm trying to simply save a file. However, I need a filename entered without a suffix to automatically get a default suffix (which setDefaultSuffix() does).

I'd rather not completely lose the native save dialog just for this. exec() is not overloaded from QDialog, so it totally bypasses the native hook (ignoring the DontUseNativeDialog option even if it's false).

If I disable the file overwrite warning and append the default suffix myself after the function returns, then I'd be re-opening the dialog if the user did not want to overwrite... and that's just ugly.

Is there some signal I can catch and quickly inject the default suffix if it's not there? I'm guessing not, since it's a native dialog.

Is there something I'm doing wrong with the filter? I only have one filter choice. It should use that extension.

This seems pretty lame. Launching the save dialog and simply typing "test" should never result in an extensionless file. "test.", yes. "test" no way. That'll really confuse the users when they hit Load and can't see the file they just saved.

I guess the cross-platform part of Qt is giving me lowest common denominator file dialog functionality?

© Stack Overflow or respective owner

Related posts about qt

Related posts about qt4