[Development] Qt 5 QSessionManager

Samuel Gaist samuel.gaist at edeltech.ch
Mon Jul 22 23:19:00 CEST 2013

On 22 juil. 2013, at 23:07, David Faure wrote:

> On Monday 22 July 2013 22:55:45 Samuel Gaist wrote:
>> On 22 juil. 2013, at 10:25, Alberto Mardegan wrote:
>>> On 07/21/2013 01:21 AM, Samuel Gaist wrote:
>>> [...]
>>>> 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.
>>> Not really: the destructor is virtual, because the class inherits from
>>> QObject, whose destructor is virtual.
>>> Also, there is a d pointer, the one from QObject: QObject provides a
>>> constructor which takes a QObjectPrivate class. You can subclass
>>> QObjectPrivate, add your members, and then pass your QObjectPrivate
>>> subclass to the QObject constructor when you initialize it.
>> But since both constructor and destructor are private, AFAIK, I can't just
>> subclass it. Only a friend object or a class function can create a
>> QSessionManager.
>> Currently, I don't see any way to specialize QSessionManager in a platform
>> independent no binary breaking way (thinking QPA).
>> The only alternative that comes to my mind at this time would be to use
>> platform #ifdefs in qsessionmanager.cpp and modify QSessionManagerPrivate
>> to contain what would be needed. But it doesn't feel right to me.
>> Any idea or suggestion ?
> I think you should create a new QPA base class with virtuals and just let the 
> public QSessionManager forward calls to that class.
> And then QPA plugins can reimplement the virtuals from the internal QPA base 
> class.

Very good !

Something like a QPlatformSessionManager returned by the QPluginIntegration ?

It would essentially replace the current content of QSessionManagerPrivate with functions.

Am I following you right ?

Should there be an abstract for this class with a default implementation (i.e QDefaultPlatformSessionManager) ? Or having the base class would be enough ?

More information about the Development mailing list