[Interest] promoting a QGuiApplication to a QApplication?

Furkan Üzümcü furkanuzumcu at gmail.com
Wed Jul 11 20:27:25 CEST 2018


> 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 <rjvbertin at 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 at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180711/6eb63cf2/attachment.html>


More information about the Interest mailing list