Hi
In this code i have to write all the items of a QStringList into a text file:
if (fileName.isEmpty()){
//
}else{
tr("Cannot write file %1:\n%2.")
.arg(fileName)
.arg(file.errorString()));
}else{
//here
out << "i want to write the content of the QStringList x here";
file.close();
}
}
QString fileName = QFileDialog::getSaveFileName(this);
if (fileName.isEmpty()){
//
}else{
QFile file(fileName);
if (!file.open(QFile::WriteOnly | QFile::Text)) {
QMessageBox::warning(this, tr("Application"),
tr("Cannot write file %1:\n%2.")
.arg(fileName)
.arg(file.errorString()));
}else{
QTextStream out(&file);
//here
out << "i want to write the content of the QStringList x here";
file.close();
}
}
To copy to clipboard, switch view to plain text mode
I read about using QVariant for this purpose!
Is this the right approach?
Can someone provide me with an example?
Thanks
Bookmarks