Access to the user interface
-
Now it's working a 'bit'.
It is able to read the file and print it into the output, BUT it doesn't save onicode ... and I need unicode so we have to find an other solution :/ :D
@bool Data::openContent(bool customFileName){
if(itsContentFilename.isEmpty() || customFileName)
itsContentFilename= QFileDialog::getOpenFileName(MyFxhnn, tr("Inhalt öffnen"), QString(), tr("Fxhnn Content Files (*.txt)"));if(!itsContentFilename.isEmpty()){ QFile file(itsContentFilename); if(!file.open(QIODevice::ReadOnly)){ QMessageBox::critical(MyFxhnn, tr("Error"), tr("Could not open file")); return false; } //QTextStream in(&file); //QMessageBox::information(MyFxhnn, "Inhalt von readAll()", file.readAll()); QByteArray tempString = file.readAll(); itsContent = tempString; QMessageBox::information(MyFxhnn, "Inhalt von itsContent", itsContent); printItsContent(); file.close(); if((itsContent != MyFxhnn -> ui -> itsText -> toPlainText()) || itsContent == ""){ QMessageBox::critical(MyFxhnn, tr("Error"), tr("Fehler beim Öffnen, Data != Textfeld")); return false; } } return true;
}@
and here are the printItsContent():
@void Data::printItsContent(){
//MyFxhnn -> ui -> itsText->clear(); <- If I uncomment this line it clear the output text, but it can't set it again
MyFxhnn -> ui -> itsText -> setPlainText(itsContent);
setItsEncryptLevel(0);
setItsShuffleLevel(0);
return;
}@ -
That's the kind of detail that's good to share.
Then it seems that you should use QTextCodec
-
What do you mean by "only with textstream" ?