[Development] Qt 5 QSessionManager

Samuel Gaist samuel.gaist at edeltech.ch
Sun Jul 21 00:21:01 CEST 2013


After starting the implementation of a basic session management for OS X in Qt 4, I wanted to port it to Qt 5 and I have hit a wall.

In Qt 4 the various functions of QSessionManager where implemented in several places (originally qapplication_XXX.cpp files and qcocoaapplicationdelegate_mac.mm for my patch) using #if defined to avoid multiple function definitions. Re-using the same principle in Qt 5 would break the idea of platform plugins so I thought about moving the creation of the QSessionManager from QGuiApplicationPrivate to QPlatformIntegration and provide a subclass of QSessionManager for OS X (the other platform if possible following later). Now there's the wall: all functions from QSessionManager are non virtual (even the destructor) and it has no d pointer, so subclassing it will prove to be complicated.

If I have understood correctly the rules for keeping binary compatibility (from the kde techbase entry) it is forbidden to change a function from non-virtual to virtual (please correct me if I'm wrong), in that case would the Q_GLOBAL_STATIC QHash technique be the way to go ?

More information about the Development mailing list