setWindowModality problem!!!
-
i use setWindowModality to dynamically change a QDockWidget's modality.
but i met a problem!void MyDockWidget::closeEvent(QCloseEvent* event) { if (windowModality() == Qt::ApplicationModal) //WindowModality also failed... setWindowModality(Qt::NonModal); QDockWidget::closeEvent(event); }
here i want to reset it back to non-modal....but after i close the modal one....the whole Qt app including the MainWindow and other windows Cannot clicked....the whole app seems be Frozen....i don;t know why...
-
As far as I understand modality should not be changed after widget is shown,
It is not simply a state, it is much more.
Question is why do you want to do it.
Mostly likely you should change the design to avoid this.
But here is what documentation says:
"Changing this property while the window is visible has no effect; you must hide() the widget first, then show() it again."