[skip ci] improve possibility to create a QApplication in a thread

This commit is contained in:
wmayer
2020-06-21 00:07:21 +02:00
parent 002e25b561
commit daec778694
3 changed files with 9 additions and 3 deletions

View File

@@ -109,6 +109,9 @@ FreeCADGui_showMainWindow(PyObject * /*self*/, PyObject *args)
#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
#endif
// This only works well if the QApplication is the very first created instance
// of a QObject. Otherwise the application lives in a different thread than the
// main thread which will cause hazardous behaviour.
QtApplication app(argc, argv);
if (setupMainWindow()) {
app.exec();