PDA

View Full Version : qfile dialog error



SirJonas
1st November 2016, 20:55
Hi i was checking to modify the content of one file but show me this error:
shell\comdlg32\fileopensave.cpp(14247)\comdlg32.dl l!77B01E65: (caller: 77B3268C) ReturnHr(1) tid(2114) 80004005 Error no especificado
CallContext:[\PickerModalLoop]

What does it mean? I was only creating the file and writing.
I think is because for this line:
myfile.setFileName(QFileDialog::getSaveFileName(th is,"myfile"));

Show me this error

SirJonas
2nd November 2016, 01:11
it's for this
ui->textfield->setText(QFileDialog::getOpenFileName(this,"Abrir archivo"));

Anyways i tried to update with the example of qt 5.7 and take me the same error. I think it's a bug for windows 10.
I was thinking that was solved but i think it's not possible to solve it.

jefftee
2nd November 2016, 02:10
I'm going to go out on a limb and guess that QFileDialog::getOpenFileName works on Windows 10. What's the stack trace when your program crashes?

d_stranz
2nd November 2016, 15:08
ui->textfield->setText(QFileDialog::getOpenFileName(this,"Abri r archivo"));

It is never a good idea to write statements like this which do no error checking and make it more difficult to find an error if it occurs.

Is "this" a valid pointer at the place where you use it? If the object that "this" points to isn't valid, then "ui" and "ui->textfield" won't be valid either.

Is "textfield" a valid pointer to a QLineEdit / QTextEdit?

Break your statement into two or more lines. First call the QFileDialog method and assign the result to a QString. You can check that to see that it is valid and that the method worked. (You can also set a breakpoint on that statement to confirm that "this" is valid). Next, call setText() to put the QString into the text edit. (At the same time you can confirm that "ui" and "textfield" are valid pointers).