rookee
17th November 2015, 19:47
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())
{
QFile f(fileName);
if(!fileName.endsWith(".csv"))
fileName = fileName + ".csv";
f.open(QIODevice::WriteOnly);
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())
{
QFile f(fileName);
if(!fileName.endsWith(".csv"))
fileName = fileName + ".csv";
f.open(QIODevice::WriteOnly);