2
votes

Is there a way of opening a QDialog window-modal with exec()? open() returns immediately, and exec() shows the dialog application-modal instead of window-modal. How to take the best of both methods?

1

1 Answers

3
votes

In Qt there exist window-modality.

For example, showing a dialog this way, from inside a QWidget-derived class, will make the dialog window-modal to its parent:

  QDialog d(this);
  //...
  d.setWindowModality(Qt::WindowModal);
  d.exec();

being this a QWidget, set as the QDialog parent.