Hi,
I'm trying to save the files with a default extension. With the following code snippet, the file does save with the specified file name but it doesn't attach the extension to it. Can someone please help me. Thanks in advance.
QString fileName
= QFileDialog::getSaveFileName(this, tr
("Save Logs"),
"/Tmp/",tr
("*.csv"));
if(!fileName.isEmpty())
{
if(!fileName.endsWith(".csv"))
fileName = fileName + ".csv";
QString fileName = QFileDialog::getSaveFileName(this, tr("Save Logs"),"/Tmp/",tr("*.csv"));
if(!fileName.isEmpty())
{
QFile f(fileName);
if(!fileName.endsWith(".csv"))
fileName = fileName + ".csv";
f.open(QIODevice::WriteOnly);
To copy to clipboard, switch view to plain text mode
Bookmarks