FreddyKay
20th November 2014, 14:18
Hey guys!
I got the fllowing problem, which is new for me. I want the user to enter a file location and file name, that I can use to create a file obviously. I got the following code for this:
void SpacecraftDataView::saveToFile(){
QString fileName = QFileDialog::getSaveFileName(this, "Save Data", "", "Textdatei (*.txt);;All Files(*)");
if(fileName.isEmpty()){
return;
}else{
QTextDocumentWriter writer(fileName);
if(!writer.write(&dataProcessor->getDocument())){
QMessageBox::information(this, tr("Unable to write to file"), "Writing to file was not possible.");
return;
}else{
//! \todo something here
}
}
}
Note it does not execute past the getSaveFileName part. This does open a QFileDialog which then freezes in the middle of its execution, see screenshot:
http://imagizer.imageshack.us/a/img661/1187/bK1j4n.jpg
So what am I doing wrong?
I got the fllowing problem, which is new for me. I want the user to enter a file location and file name, that I can use to create a file obviously. I got the following code for this:
void SpacecraftDataView::saveToFile(){
QString fileName = QFileDialog::getSaveFileName(this, "Save Data", "", "Textdatei (*.txt);;All Files(*)");
if(fileName.isEmpty()){
return;
}else{
QTextDocumentWriter writer(fileName);
if(!writer.write(&dataProcessor->getDocument())){
QMessageBox::information(this, tr("Unable to write to file"), "Writing to file was not possible.");
return;
}else{
//! \todo something here
}
}
}
Note it does not execute past the getSaveFileName part. This does open a QFileDialog which then freezes in the middle of its execution, see screenshot:
http://imagizer.imageshack.us/a/img661/1187/bK1j4n.jpg
So what am I doing wrong?