[Qt-interest] QFileDialog::getOpenFileName Directory name setting
Malyushytsky, Alex
alex at wai.com
Tue Jun 8 04:00:44 CEST 2010
First of all I would advice to decide do you want to use static function or QFileDialog instance. There is no reason to mix them, so revise your code appropriately.
In case of static replace your code with:
QString str = "F:/Work/FILES";
QString dynFile = QFileDiag::getOpenFileName(this,"Select..", str ,"File (*.D)");
Regards,
Alex
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of yogesh upreti
Sent: Monday, June 07, 2010 3:20 PM
To: qt-interest at trolltech.com
Subject: [Qt-interest] QFileDialog::getOpenFileName Directory name setting
Dear Group,
I am using QFileDialog::getOpenFileName to allow user to select a file, but I am not able to set the directory for this function to look for a file. When my code looks like :
1.
QFileDialog fileDiag;
QString str = "";
fileDiag.setViewMode(QFileDialog::List);
str = "F:/Work/FILES";
fileDiag.setDirectory(str);
dynFile = fileDiag.getOpenFileName(this,"Select..", str ,"File (*.D)");
Dialog box opens in the same directory as the programme
But when my code is
2.
QFileDialog fileDiag;
fileDiag.setViewMode(QFileDialog::List);
dynFile = fileDiag.getOpenFileName(this,"Select..", "F:/Work/FILES" ,"File (*.D)");
Dialog box open in "F:/Work/FILES/" dir.
Can any one sees the mistake in case 1. ?? Have anyone else also seen this problem ?
- Yogi
---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.
“This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you.”
“Please consider our environment before printing this email.”
More information about the Qt-interest-old
mailing list