Results 1 to 7 of 7

Thread: Simple Question on getExistingDirectory

  1. #1

    Smile Simple Question on getExistingDirectory

    I'm implement a QFileDialog::getExistingDirectory() over a click of a button ......

    but the ExistingDirectory is showing me all the directories including the CD-ROM and the
    Maped-Drives .......

    I have Two Maped_Drives ,CD-ROM and CD-Writer on my system .....

    but i dont want these to displayed when I click that button.......

    Is there any way i can filter some of the existing Drives on my System

    Could Anyone Help

    Regards
    Thanks in Adv
    Naveen

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Simple Question on getExistingDirectory

    I think getOpenFileNames() is more what you are looking for.

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Simple Question on getExistingDirectory

    Unfortunately it doesn't seem to be possible to filter certain drive types.

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Simple Question on getExistingDirectory

    Well, you can overload it, and build in that logic for filterinf drive types.
    But I am not sure how can know what type is a given drive...

  5. #5
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Simple Question on getExistingDirectory

    After taking a look at QFileDialog sources, basically one would have to write it's own
    dialog for this kind of behaviour. Subclassing does not help much in this case..

    But anyway, yes, the problem might be detecting drive types and probably needs using of platform dependant APIs.
    Let me assume this is a windows environment, so for example you could try using GetDriveType.

    It could even be quite simple to implement that kind of dir selection dialog for windows.
    Basically you could try subclassing QDirModel and remove/hide model indexes belonging to other than DRIVE_FIXED type drives.
    Then just show the model in a tree view, dunno if it's really as simple as it sounds..

  6. #6

    Question Re: Simple Question on getExistingDirectory

    I'm sorry --what i meant was ---- i have a button which when clicked ---shows me the directory structure........

    This I doing by a simple Signal and Slot method like this

    connect(button,SIGNAL(clicked()),this,SLOT(button_ Clicked()));

    I'm not implementing or overloading anything.....

    yes the Operating System is Windows XP....

    Could u explain what this "subclassing QDirModel and remove/hide model indexes " is

    Could u give me few more opinions

    Naveen.....
    Last edited by Naveen; 3rd March 2006 at 05:34.

  7. #7
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Simple Question on getExistingDirectory

    Yes I understood that you're launching the dialog for directory selection upon that button click. QFileDialog simply does not bow to your wishes when it comes to filtering out certain drive types or so. And there doesn't seem to be a way to add that behaviour by subclassing QFileDialog either.

    Qt doesn't provide any way to check drive types. But alright, the environment has been outlined to windows, which offers a way to do that, as I mentioned in the earlier post. QDirModel provides a data model for the filesystem. It is extremely easy to just display filesystem contents in a tree by using QTreeView+QDirModel (QFileDialog uses QDirModel too, internally).

    Here's a tiny example for showing directories of fixed hard drives. Examine and understand the code. All you need to do is to create a dialog with appropriate buttons and the example tree..
    Attached Files Attached Files
    Last edited by jpn; 3rd March 2006 at 09:48.

Similar Threads

  1. Simple RegExp Question...
    By jared.carlson23 in forum Newbie
    Replies: 1
    Last Post: 4th July 2008, 14:10
  2. a simple noob question
    By wrproject in forum Newbie
    Replies: 1
    Last Post: 1st July 2008, 23:25
  3. QTextEdit simple question
    By Marcopolo in forum Qt Tools
    Replies: 4
    Last Post: 11th October 2007, 00:01
  4. simple thread layout question
    By mhoover in forum Qt Programming
    Replies: 1
    Last Post: 12th August 2006, 11:02
  5. QTextEdit Qt4: simple question
    By TheKedge in forum Qt Programming
    Replies: 4
    Last Post: 18th January 2006, 12:03

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.