[Qt-interest] QFileDialog::getOpenFileName Directory name

K. Frank kfrank29.c at gmail.com
Wed Jun 9 03:58:25 CEST 2010


Hello Alex -

On Tue, Jun 8, 2010 at 6:27 PM, Malyushytsky, Alex <alex at wai.com> wrote:
> If you are sure you get such behavior ( I would suggest place call right after another in your test case to verify )   it might be possible that there is a bug in Qt. In this case you should report  the buf with details about your compilers/platform.
>
> But first I would try to change directoryPath to
>
> QString directoryPath = "/foo/bar/baz"; // remove '/' from the end

But note in my test (done with windows-style "\" rather than
unix-style "/") that "/foo/bar/baz/" was interpreted as directory
"/foo/bar/baz/" and no pre-loaded file name, while "/foo/bar/baz"
(no trailing "/") was interpreted as directory "/foo/bar/" and
pre-loaded file name "baz".

K. Frank

> ...
> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of yogesh upreti
> Sent: Tuesday, June 08, 2010 4:36 AM
> To: qt-interest at trolltech.com
> Subject: Re: [Qt-interest] QFileDialog::getOpenFileName Directory name
>
> Hallo Oliver,
> I was aware about the fact that its a static method, so I first wrote the code without an instance. But my problem is this. If I write:
>  QString filePath = QFileDialog::getOpenFileName(this, "Caption", "/foo/bar/baz/", "*.D"); (this is what I mean giving dir path explicitly);
> it opens the dialog box in "/foo/bar/baz/" dir.
> But if I write it
> QString directoryPath = "/foo/bar/baz/";
> QString filePath = QFileDialog::getOpenFileName(this, "Caption", directoryPath, "*.D");
>
> it dosen't open it in "/foo/bar/baz/" instead it opens it in current working dir. I am using Nokia Qt SDK 2010 for compiling my programme.
>
> I will try in the way you said (example with fd.exec()) and give the feedback.
>
> Thanks
> Yogesh
> ...




More information about the Qt-interest-old mailing list