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
}
}
}
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
}
}
}
To copy to clipboard, switch view to plain text mode
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:

So what am I doing wrong?
Bookmarks