As far as I understand application event loop is not running until modal widget event loop is running. Closing the widget will start application event loop and you get your message printed. It would be worth if widget delete itself on closing, then you would have a crush.
I guess comment in documentation stays there since QT 4.1. Alex On Thu, Sep 19, 2013 at 12:00 PM, Jenssen Tim <tim.jens...@digia.com> wrote: > I had a confusing problem on Mac with Qt 4.8 and as a side note but it > works with 5.2. > > If I start the following application I get the "test print" immediately > after the start. > If I start my test application with "modal" the "test print", comes if I > close the window. > What is the cause? (Does it creates an own event loop on mac? why does it > work on windows and linux?) > > > #include <QWidget> > #include <QApplication> > #include <QDebug> > > class TestWidget : public QWidget > { > Q_OBJECT > public: > TestWidget() { > QMetaObject::invokeMethod(this, "printTest", Qt::QueuedConnection); > } > public slots: > void printTest() { qDebug() << "test print"; } > }; > > > int main(int argc, char *argv[]) > { > QApplication a(argc, argv); > TestWidget* myTest = new TestWidget(); > if (a.arguments().contains("modal")) > myTest->setWindowModality(Qt::WindowModal); > myTest->show(); > return a.exec(); > } > > #include "main.moc" > > PS: In the documentation even in Qt 5.x There is some strange comment at > WindowModality: "This property only makes sense for windows." <- which is > not true, or I am wrong? > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest >
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest