QDialog as a QMdiSubWindow: Weird behavior when minimizing
Unsolved
General and Desktop
-
Hello!
This short program creates a QDialog as a MDI sub window.
I've noticed that minimizing the dialog makes the QDialog::exec() event loop to finish. Which makes no sense at all.
Anybody has an idea about how to solve this?
Thank you very much!
#include <QApplication> #include <QtWidgets> int main(int argc,char *argv[]) { QApplication app(argc,argv); QMainWindow win; QMdiArea mdi; QMdiSubWindow *sub; QDialog dlg; win.setCentralWidget(&mdi); win.show(); sub=mdi.addSubWindow(&dlg); sub->resize(win.size()/2); qDebug() << "before dlg.exec()"; dlg.exec(); qDebug() << "after dlg.exec()"; win.close(); return 0; }
I hope I'm overlooking some small detail and that the solution is simple haha
-
@Alvein
I don't know the answer to your question. But it always surprises me why anyone would use aQDialog
as anything other than what it is intended for, such as an MDI subwindow:A dialog window is a top-level window mostly used for short-term tasks and brief communications with the user.