PDA

View Full Version : QFileDialogPrivate::encodeFileName treats ":" as illegal



ericwny
16th September 2008, 22:03
I have been trying to use the getOpenFileName() static function of QFileDialog in non-native mode. However, because QFileDialogPrivate::encodeFileName() treats ':' as illegal I cannot get the dialog to start in the directory I want.

Sorry if this is an old bug, I am using commercial version 4.0.1. I haven't been able to find any evidence this behavior has been fixed.

Or is there a way to represent an absolute path with drive letter and colon?

santhoshv84
17th September 2008, 07:05
Hi,

If you want to give the absolute path.
Use like this..

QString MovieName = QFileDialog::getOpenFileName(this, tr("Open File"), "d:\\", tr("Images (*.gif)"));

Thanks and regards,
Santhosh

ericwny
17th September 2008, 15:04
Yeah....
Thanks, but that's what I am doing and stepping into the source code (again, of version 4.0.1) it is clear that QFileDialogPrivate::encodeFileName() is altering the path. In this case because "d:\\ " contains the illegal character ':' it gets changed to d%3A\\. Technically the '\' is illegal too. You have to use '/'.

Anybody know what version - if any - this is fixed in?