[Interest] promoting a QGuiApplication to a QApplication?
René J.V. Bertin
rjvbertin at gmail.com
Wed Jul 11 11:28:48 CEST 2018
Hi,
I'm tinkering with using a Qt plugin that expects a QApplication in a QGuiApplication (specifically, a QML application using QGuiApplication).
I'm not doing anything that causes a straight crash (or haven't run into that one fatal instruction yet), but I do wonder:
is it in any way possible to promote a QGuiApplication instance to a QApplication? Somewhat unexpectedly, `dynamic_cast<QApplication*>(qApp)` behaves as `static_cast` or `const_cast` in this case (= it returns qApp). Or it returns a nullptr in
QGuiApplication app(argc, argv);
QApplication *gapp = dynamic_cast<QApplication*>(&app);
which is probably what you'd expect.
Still, with QApplication inheriting QGuiApplication one could think that the former does some initialisation the latter lacks and that it should be possible to perform those steps at a later stade. Is it?
Thanks,
R.
More information about the Interest
mailing list