ich möchte meinen text aus einem qtextedit einfach in eine datei speichern.
ist ja ansich kein problem.
als fehlermeldung erhalte ich allerdings, das text kein element von qtextedit ist. in der doku steht es aber drin.
QString QTextEdit::text () const
Returns all the text in the text edit as plain text.
See also setText().
hier meine save funktion
Code: Alles auswählen
void TestWidget::saveFile()
{
QString text = textEdit->text();
QFile f( fileName );
if ( !f.open( QFile::WriteOnly ) ) {
return;
}
QTextStream t( &f );
t << text;
f.close();
}
danke im voraus!