so far i have:
void listBoxx::saveFile()
{
QString filename
= QFileDialog::getSaveFileName(this, tr
("Save List"),
"", tr
("Text Files (*.txt);;All Files (*)"));
if (filename.isEmpty())
return;
else {
QMessageBox::information(this, tr
("cannot open file"),
file.
errorString());
return;
}
m_textEdit << m_newList;
stream << m_newList;
file.close();
}
void listBoxx::saveFile()
{
QString filename = QFileDialog::getSaveFileName(this, tr("Save List"), "", tr("Text Files (*.txt);;All Files (*)"));
if (filename.isEmpty())
return;
else {
QFile file(filename);
if (!file.open(QIODevice::WriteOnly)) {
QMessageBox::information(this, tr("cannot open file"), file.errorString());
return;
}
QTextStream m_textEdit(&file);
m_textEdit << m_newList;
QDataStream stream(&file);
stream << m_newList;
file.close();
}
To copy to clipboard, switch view to plain text mode
and i'm able to save a file to a folder, but then when I click the file to open in, it says "file is of an unknown type". and the contents are still not saved to the file either.
Bookmarks