hedgar2017
hedgar2017

Reputation: 1657

QDialog window modality

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?

Upvotes: 2

Views: 5563

Answers (1)

p-a-o-l-o
p-a-o-l-o

Reputation: 10067

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.

Upvotes: 4

Related Questions