[Interest] promoting a QGuiApplication to a QApplication?
René J.V. Bertin
rjvbertin at gmail.com
Wed Jul 11 19:30:37 CEST 2018
On Wed, 11 Jul 2018 08:01:25 -0700, Thiago Macieira wrote:
> There's no such C++ concept as "promote a class". What you're asking is
> not possible.
I think I got confused myself with dynamic_cast, but of course what I had
in mind was not modifying the instance itself, but create a new
QApplication instance from the original QGuiApplication instance. That's
what dynamic_cast also does when it doesn't simply return the original
pointer, no?
I have now seen from the code that this would probably be possible but not
without refactoring.
As I wrote in a private reply, maybe that one day it will be concluded
that QGuiApplication could be rolled into QApplication (because what's a
GUI application without widgets of some kind?). From an admittedly cursory
glance at qapplication.cpp it seems that a QApplication initialised with a
"noWidgets" flag would be largely identical to a QGuiApplication instance.
It also seems that the widget-related initialisations could be deferred
until they're actually needed in which case every QApplication would start
out as a QGuiApplication.
Maybe in Qt 7? :)
R.
More information about the Interest
mailing list