[Qt-interest] QFileDialog defaultSuffix
John Cummings
jcummings2 at users.sf.net
Tue Feb 9 21:18:43 CET 2010
I am trying to use the defaultSuffix feature of QFileDialog while
choosing a file to save. I have come across a bug or feature that I am
unsure how to overcome. I have attached a small (less than 60 lines)
example that demonstrates the problem. I would be glad to submit a bug
unless someone tells me what I am missing. I have tried both Qt 4.4.x
and Qt 4.6.0 on Linux.
In the attached example, the added "QLineEdit" below the main
QFileDialog area is connected to a slot that sets the defaultSuffix.
However, it appears that even though I set the defaultSuffix after I
have typed in a file name, the defaultSuffix is not used to check for
the existence of a file. More generally, the defaultSuffix is not used
in the selectedFiles() method if it is updated after the file name has
been entered. So, to re-create the alleged bug with the attached
example, do the following from the source directory (note, I assume the
executable name is filedialog, which is not right on Windows):
1. Type "filedialog" into the "File name" line edit and click "Save."
2. You are correctly prompted to confirm the overwrite of the
"filedialog" file.
3. Type "pro" into the unlabeled QLineEdit at the bottom of the dialog.
4. Click "Save"
5. You are incorrectly prompted to confirm the overwrite of the
"filedialog" file. You really should be prompted about the
"filedialog.pro" file existing.
6. Until you change the "File name" line edit, the unlabeled QLineEdit
will not have any effect.
So, may question is, have I missed something? Is there an update() type
call (I've tried update in this case and it doesn't help) that I need to
make?
Thank you
John Cummings
-------------- next part --------------
A non-text attachment was scrubbed...
Name: filedialog.h
Type: text/x-chdr
Size: 291 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100209/1e13a168/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: filedialog.cpp
Type: text/x-c++src
Size: 623 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100209/1e13a168/attachment-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cpp
Type: text/x-c++src
Size: 218 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100209/1e13a168/attachment-0002.bin
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: filedialog.pro
Url: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100209/1e13a168/attachment.pl
More information about the Qt-interest-old
mailing list