[Qt-interest] Problem with selecting a directory
Nouman Khalid
shanik19.gemini at gmail.com
Mon Apr 20 09:06:26 CEST 2009
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> 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
> 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/2af7bcac/attachment.html
More information about the Qt-interest-old
mailing list