[Qt-interest] Problem with selecting a directory
fares.abdullah at sosco.com
fares.abdullah at sosco.com
Mon Apr 20 09:15:20 CEST 2009
Hi Nouman,
Yes, it is the QT version.
See here for the QT 3.3 version of this method: http://doc.trolltech.com/3.3/qfiledialog.html#getExistingDirectory
The example there is:
QString s = QFileDialog::getExistingDirectory(
"/home",
this,
"get existing directory",
"Choose a directory",
TRUE );
Cheers,
- Fares
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of ext Nouman Khalid
Sent: Monday, April 20, 2009 4:06 PM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] Problem with selecting a directory
Thanks Ferenc but my compiler is giving me following error:
error: 'ShowDirsOnly' is not a member of 'QFileDialog'
My qt version is 3.3.8b....meaning 'not' latest. Does dat have anything to do with the error.
On Mon, Apr 20, 2009 at 11:04 AM, Ferenc Stelcz <ferenc at stelcz.hu<mailto:ferenc at stelcz.hu>> wrote:
Nouman Khalid wrote:
> Hi all,
>
> I want to select a directory where my application where perform other
> functions. I know how to set directory with the help of
>
> QDir::setCurrent ( const QString & path )
>
> but i don't want user to remember the path to enter. I want a dialogue box
> to open (when user may click on say 'Select directory' button) from where he
> can browse through the filesystem to finally select a directory or even to
> make a new directory and then selecting that newly made directory as target.
>
> Any idea?
>
> Thanks
> Nomi
>
Try this:
QString dir =
QFileDialog::getExistingDirectory(
this,
tr("Open Directory"),
"/home",
QFileDialog::ShowDirsOnly);
This pops-up a file dialog where you can select (any _existing_)
directories just as you would from any other application. Then you can
pass *dir* to setCurrent() or do with it whatever you like! HTH
--
Ferenc Stelcz
Junior Software Engineer
Banyan Technologies LLC.
__________ Information from ESET Smart Security, version of virus signature database 4020 (20090420) __________
The message was checked by ESET Smart Security.
http://www.eset.com
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com<mailto:Qt-interest at trolltech.com>
http://lists.trolltech.com/mailman/listinfo/qt-interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090420/d461f03f/attachment.html
More information about the Qt-interest-old
mailing list