[Development] Ref-counted quit

Lincoln Ramsay lincoln.ramsay at nokia.com
Mon Jan 9 02:53:56 CET 2012


On 12/30/2011 10:48 AM, ext Stephen Kelly wrote:
> The ref counted quit feature I was working on was vetoed. At the moment
> it looks like Qt will not get a ref counted quit feature. It is blocked
> because no solution has been proposed.

A different proposal: Why not just abstract the relevant bits out of 
QWidget/QGuiApplication?

QObject -> QTask*

QWidget either inherits from QTask or contains one (to avoid direct 
invocation of the task methods, though re-implementing them as private 
methods would also work).

Then the logic behind quitOnLastWindowClosed can be moved into 
QCoreApplication as quitOnLastTaskFinished.

A window is marked as finished when it's closed (and unfinished if it's 
shown again). A QWidget that isn't a window is marked as finished.

Apps can then make their own QTask instances and manage them however 
they want. When the last one is finished (or deleted) then the app quits.


* I'm sure we can bikeshed a better name than QTask :)

-- 
Lincoln Ramsay - Senior Software Engineer
Qt Development Frameworks, Nokia - http://qt.nokia.com/



More information about the Development mailing list