[Development] A new approach for Qt main()

Morten Sorvig Morten.Sorvig at qt.io
Fri Dec 9 16:29:51 CET 2016


> On 9 Dec 2016, at 14:51, Andre Poenitz <Andre.Poenitz at qt.io> wrote:
> 
> 
> Whatever the problem is, I think we should try hard to have a solution 
> that 1. does not use macros and 2. that does not optically change the 
> int main(int argc, char *argv[]) { QApplication app(argc, argv)... } stanza.

This sounds like the current approach, where we solve the startup issue by
adding complexity to the Qt platform implementation that allows us to keep 
main().

The suggested approach would solve the issue by changing the API, and the
motivation is a simplification of the Qt platform implementation. So the
benefit is perhaps not immediately clear to those not directly involved
with Qt platform development, except for the potential for faster developed,
more stable Qt.

> 
> Macros look and feel ugly and outdated in contemporary C++, are harder 
> to debug, etc etc. Changing away from a normal main will make look Qt
> code alien, not to mention the necessary adaptation in documentation
> and each and every "getting started with Qt" tutorial out there. This would
> be a high price to pay.

Indeed if keeping the normal main (and docs etc) is very important then
that could tip the scales over to not making API changes.

Morten


More information about the Development mailing list