[Development] A new approach for Qt main()

Eskil Abrahamsen Blomfeldt eskil.abrahamsen-blomfeldt at qt.io
Fri Dec 9 12:58:46 CET 2016

Den 09.12.2016 12:40, skrev Tor Arne Vestbø:
> On 09/12/2016 11:44, Lars Knoll wrote:
>> Well, the problem is that the main() entry point is causing huge amounts
>> of issues on at least Android and iOS.
> I don't know about Android, but on iOS this is patently false. While 
> the workaround is complex, it has worked very well in the 3 years 
> since its inception. Please don't use iOS as a straw-man in this 
> discussion.

Speaking for Android, there are and have been thread synchronization 
issues due to Qt running a synchronous event loop in the main function. 
It is also impossible to make applications with multiple entry points 
and complex life cycles, which you would expect in an Android 
application consisting of several activities and services that can be 
triggered independently and simultaenously. Our work-around for this is 
to limit support to applications with one activity or one service per 
process in the application.

So while we have been able to find solutions for most our problems, both 
on Android and iOS, I guess Lars' point is that we are encountering more 
and more cases where we have to invent hacks and work-arounds and 
document limitations in order to be functional on modern platforms. It 
might be a sign that we should adapt.

Eskil Abrahamsen Blomfeldt
Senior Manager, R&D

The Qt Company
Sandakerveien 116
0484 Oslo, Norway
eskil.abrahamsen-blomfeldt at qt.io

More information about the Development mailing list