[Interest] What is different with the eventloop if I am setting Qt::WindowModal on Mac?
Jenssen Tim
Tim.Jenssen at digia.com
Thu Sep 19 21:00:44 CEST 2013
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?
More information about the Interest
mailing list