PDA

View Full Version : How set default file to save in QFileDialog



estanisgeyer
29th January 2009, 11:44
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?



QFileDialog dialogFile(this);
dialogFile.setDefaultSuffix("xml");
QString filename = dialogFile.getSaveFileName(this, QString::FromUtf8("Save file - XML distr."), tr("test.xml"), tr(".xml"));


Thanks,

Marcelo E. Geyer

jpn
29th January 2009, 12:09
Try the way it is demonstrated in QFileDialog::getSaveFileName() docs.