Modal QDialog inside QMdiArea
Hi
I am trying to use modal (Qt::WindowModal) QDialog inside QMdiArea and it doesn't work.
Here is example code:
Code:
#include <QApplication>
#include <QtGui>
int main(int argc, char *argv[])
{
QMdiArea* area = new QMdiArea();
mainWin.setCentralWidget(area);
//window 1
w->setWindowTitle("w");
w->setLayout(layout);
area->addSubWindow(w);
//window 2
w2->setWindowTitle("w2");
w2->setLayout(layout2);
QMdiSubWindow* sw2 = area->addSubWindow(w2);
mainWin.show();
//dialog
d.setWindowTitle("d");
d.setWindowModality(Qt::WindowModal);
d.setLayout(layout3);
area->addSubWindow(&d);
d.exec();
return app.exec();
}
Dialog should block window 2, but it deasn't block anything. It looks like ordinary window.
What is the correct way to do this?
Thank you.
Re: Modal QDialog inside QMdiArea
I'm also trying to do something like that.
I want to have a number of QMdiArea tabs, and in every of them - modal window stack.
It's not working probably because QMdiSubWindow handles all the stuff and it's not modal dialog by origin...