Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[SOLVED]QDialog problem, how i can keep the QDialog show until some case matches?
opengpu2 last edited by opengpu2
i write a dialog, which let the user enter a fileName, i want to keep the dialog show Until user enter a fileName which does Not exist.
i write like this in the func:
if (dlg.result() == QDialog::Accepted)
but i found it's wrong. what should i do this work?
I would not wait for the dialog to be closed. You should reimplement QDialog class and handle the OK button yourself: when a file exists, you should reject the result. If it does not, you can set the Accepted state.
opengpu2 last edited by
yeh, i inherit from QDialog, and reimplement the accept.
but u know, it's easy and convient to do this Check in the window's slot, But not the custom QDilaog, because the relative path is in the window, and i don't want to pass these related param to the QDialog.
Sorry, I don't understand your resoning. How is it possible for the dialog (where the user selects the path and file name) not to know the file name?