[Development] Qt 5 QSessionManager

Alberto Mardegan mardy at users.sourceforge.net
Mon Jul 22 10:25:03 CEST 2013


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.

> 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 ?

Given the above, I don't think you need to go for any of this.

Ciao,
  Alberto

-- 
http://blog.mardy.it <- geek in un lingua international!



More information about the Development mailing list