Il 19/11/2014 09:35, Thiago Macieira ha scritto:
On Wednesday 19 November 2014 09:22:46 Giuseppe D'Angelo wrote:
Was adding a new override in the middle of an hierarchy safe? Or
subclasses in user code will now require a recompilation? (Not a big
deal, I don't expect that many QRubberBand subclasses with a timerEvent
override...)

Overriding a virtual from the primary base is safe, provided that it's ok for
derived classes to bypass the new override and instead call the base class's
implementation. This is independent of whether the user overrode timerEvent
again or not.

This applies to the class, not to the user of the class. If the derived class
is not recompiled, the it's like the new override is not there, regardless of
who's using the derived class. If it is recompiled, then the new virtual is
used, regardless of who created the object.

PS: all new virtual overrides should be Q_DECL_OVERRIDE.



And now this feels wrong, right? The typical implementation of timerEvent is something like:

> if (e->timerId() == myTimerId) doSomething();
> else BaseClass::timerEvent(e);

But this bypasses QRubberBand's own timer logic unless the subclass gets recompiled?

--
Giuseppe D'Angelo | [email protected] | Software Engineer
KDAB (UK) Ltd., a KDAB Group company
Tel. UK +44-1738-450410, Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-independent software solutions

Attachment: smime.p7s
Description: Firma crittografica S/MIME

_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to