In previous versions of Qt we were able to use following constructor of file dialog:
QFileDialog(QWidget * parent = 0, const char * name = 0, bool modal = FALSE)
So, it looks like it was possible to make non-modal file dialog. But now (in Qt5) we haven't such parameters in constructor. Also QFileDialog ignores setWindowModality(Qt::NonModal);
and setModal(false);
(I've checked, that if windowModality() == Qt::NonModal && isModal() == false
, file dialog window is still modal).
Do you have ideas, how to make my file dialog non-modal?
Details: my file dialog inherited from QFileDialog. It works absolutely as expected. The only thing I need is to make it non-modal, but I can't find solution on SO and on qt-project. Thank you in advance.
The "problem" is that you open the file dialog as a modal window by calling QDialog::open()
function. According to the Qt docs for QDialog::open()
:
Shows the dialog as a window modal dialog, returning immediately.
To make the file dialog non modal simply open it with QDialog::show()
.