Results 1 to 2 of 2

Thread: Making filedialog remember previous directory?

  1. #1
    Join Date
    Apr 2011
    Posts
    58
    Thanks
    1

    Default Making filedialog remember previous directory?

    Hi.

    I've a file dialog created using QString fileName = QFileDialog::getOpenFileName.

    After loading files, when the user click to open the file again,
    I like it to go straight to the previous directory that user went to locate and opened the file. How do I do that?

    Thanks!
    Marc

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Making filedialog remember previous directory?

    Pass the desired starting directory into the QFileDialog constructor. You should keep the directory from the last successful file selection for this purpose; in a member variable and/or in QSettings (esp. if you need it to remember between runs).

Similar Threads

  1. Replies: 2
    Last Post: 22nd July 2010, 03:40
  2. Replies: 2
    Last Post: 15th June 2010, 11:06
  3. remember file path
    By eric in forum Qt Programming
    Replies: 2
    Last Post: 1st April 2008, 16:52
  4. Open FileDialog showing Back of the Widget in Mac
    By shyam prasad in forum Qt Programming
    Replies: 1
    Last Post: 19th April 2007, 06:33
  5. Replies: 12
    Last Post: 7th February 2007, 13:30

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.