> That's > what dynamic_cast also does when it doesn't simply return the original > pointer, no?
dynamic_cast<Type> returns nullptr when the class you are casting is cannot be cast down to Type. Casting does not create a new instance for you. Regards, Furkan Üzümcü On Jul 11, 2018, 13:33 -0400, René J.V. Bertin <rjvber...@gmail.com>, wrote: > 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. > > _______________________________________________ > 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