PDA

View Full Version : QFileDialog::getSaveFileName issues with filename



dugs
11th December 2006, 17:38
I am using Qt3 on Linux.
I am trying to populate the save dialog with a filename that has the format "xxx:yyy".
During execution I get a message box with the error "The protocol 'xxx' is not supported".
Any ideas? Seems to me like a possible bug in Qt.

Example code:
filename = QFileDialog::getSaveFileName(startingDir + baseName, "", this);

Where baseName contains "BAND_AVERAGE_GAINS:2006-12-11_2006-12-18".

Thanks

e8johan
11th December 2006, 17:51
I'd say that putting colons in file names is bad practice. Not only does it make it impossible to use the files on Windows systems - it also makes it difficult to use when you are accessing it via different network protocols as the protocol is used to prefix the name and path (for example ftp://... or http://...)

dugs
11th December 2006, 18:17
I'd say that putting colons in file names is bad practice. Not only does it make it impossible to use the files on Windows systems - it also makes it difficult to use when you are accessing it via different network protocols as the protocol is used to prefix the name and path (for example ftp://... or http://...)

Yes, for portability, you should do that. But Qt should also support the platform Linux/Unix which does allow colons in the filename.

These names are historical, 7+years. The interface does allow you to save filenames with colons in them, it just breaks if you try to use them in the instantiation. I will probably just force the user to enter the filename manually. Which seems like the only solution available.