[Interest] QFileDialog Query

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Sat Oct 21 10:27:17 CEST 2017


Hi,

Il 21/10/2017 10:07, Dan Allen ha scritto:
> Hi,
> 
> I'm currently working on a save dialog for my application (currently
> testing in Ubuntu).  The dialog is in accept mode
> QFileDialog::AcceptSave and a default suffix of "txt" is set.
> 
> I've noticed something that appears to be strange when the file provided
> exists as follows (assuming a file "text.txt" exists for the following):
> 
> 1. If I select the existing file "text.txt" and click save, I am
> presented with the overwrite question dialog.
> 2. If I type "text.txt" as the file name and click save, I am presented
> with the overwrite question dialog.
> 3. If I type "text" as the file name (without the suffix), I am not
> presented with the overwrite question dialog and the dialog returns the
> filename "text.txt" where the default suffix has been added.
> 
> Number (3) above is concerning.  If the dialog returns a filename, I
> would assume the user has accepted overwriting it, but this doesn't
> appear to be the case.  I assume this isn't intentional and is probably
> a bug?

Likely, but it requires some investigation on where the bug actually lies.

First and foremost, are you using the native (GTK?) file dialog or the 
Qt one? You can try setting QFileDialog::DontUseNativeDialog and see if 
it makes a difference.

There are pretty much these cases:

A) Native, returning "text.txt" to Qt without showing the overwrite 
confirmation dialog. A minimal check is in order within Qt to verify 
that it's opening the native file dialog correctly (with/without any 
option that would cause such behaviour). This should result in either a 
bug report against Qt, or a bug report against GTK.

B) Native, returning "text" to Qt which then appends the file extension. 
Qt bug.

C) Non-native. Qt bug.

So, if it is a Qt bug, please report it on the bugtracker. This is 
obviously a P0, silent data loss.

Cheers,
-- 
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (UK) Ltd., a KDAB Group company | Tel: UK +44-1625-809908
KDAB - Qt, C++ and OpenGL Experts

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4007 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20171021/a8c96d19/attachment.bin>


More information about the Interest mailing list