Results 1 to 2 of 2

Thread: How set default file to save in QFileDialog

  1. #1
    Join Date
    Jan 2008
    Location
    Brasil
    Posts
    131
    Thanks
    18
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Exclamation How set default file to save in QFileDialog

    Hi friends,

    How do I set the name of a file in the window dialog QFileDialog? With this code below I can do this by putting the name "test.xml" as the file name, but this is correct? What is the best way?

    Qt Code:
    1. QFileDialog dialogFile(this);
    2. dialogFile.setDefaultSuffix("xml");
    3. QString filename = dialogFile.getSaveFileName(this, QString::FromUtf8("Save file - XML distr."), tr("test.xml"), tr(".xml"));
    To copy to clipboard, switch view to plain text mode 

    Thanks,

    Marcelo E. Geyer

  2. #2
    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: How set default file to save in QFileDialog

    Try the way it is demonstrated in QFileDialog::getSaveFileName() docs.
    J-P Nurmi

Similar Threads

  1. How to save file with QFileDialog
    By pnikolov in forum Qt Programming
    Replies: 11
    Last Post: 1st June 2012, 10:23
  2. Check for invalid file name in QFileDialog
    By darren in forum Qt Programming
    Replies: 2
    Last Post: 7th November 2008, 14:43
  3. How to set default icons of different file types?
    By merry in forum Qt Programming
    Replies: 3
    Last Post: 2nd June 2008, 15:24
  4. QFileDialog and file sequences
    By peterhillman in forum Qt Programming
    Replies: 5
    Last Post: 24th November 2007, 10:16
  5. qt-3.3.8 fail in scratchbox
    By nass in forum Installation and Deployment
    Replies: 0
    Last Post: 25th May 2007, 15:21

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.