[Qt-interest] QFileDialog::getOpenFileName Directory name [SOLVED]
K. Frank
kfrank29.c at gmail.com
Wed Jun 9 16:01:56 CEST 2010
Hi Oliver (and Yogesh) -
On Wed, Jun 9, 2010 at 9:36 AM, <Oliver.Knoll at comit.ch> wrote:
> yogesh upreti wrote on Wednesday, June 09, 2010 8:42 AM:
>
>> Hallo All,
>> It worked after I change my QString variable, as suggested by Mr.
>> Frank from QString str = "F:/Data/Files/"
>> to
>> QString str = "F:\\Data\\Files\\"
Actually, I wasn't suggesting that you change to windows-style
"\". I just used them out of laziness when I did my test.
>> + Removing statement fd.setDirectory(str)
>
> So are you now using the *static* method or using an *instance* of file dialog?
I do think that his using an instance of QFileDialog is a red herring.
I agree that it is better style to call the static member function with
QFileDialog::getOpenFileName(...);
rather that with
instanceOfAQFileDialog.getOpenFileName(...);
but my understanding is that these two calls are actually the same.
> ...
> It seems the concepts of static vs non-static method calls are still not entirely clear to you.
>
>> However when I use the method getExistingFile or getExistingDir ,
>> setting up QString str = "F:/Data/Files/" workes fine. I use the
>
> As expected.
>
>> Let's see is
>> someone else encounters the same problem then it will be good to
>> Report a bug.
>
> No, please don't file a bug report ;) It is your code, not Qt!
But, unless there is a typo in what Yogesh posted, how could it be
his code?
It's very odd. I don't see how there could be a difference between
passing a string litereal and a QString to QFileDialog::getOpenFileName.
(And I didn't see any difference in my test.)
Thanks.
K. Frank
>
> Cheers, Oliver
> --
> Oliver Knoll
More information about the Qt-interest-old
mailing list