[Development] Qt 5.4.0 header diff: QtWidgets.diff
Knoll Lars
Lars.Knoll at theqtcompany.com
Wed Nov 19 11:54:24 CET 2014
On 19/11/14 09:46, "Giuseppe D'Angelo" <giuseppe.dangelo at kdab.com> wrote:
>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?
The change is actually on qtabbar, somehow Thiago’s simplified diff left
the wrong filename in.
Yes, these kind of changes can be slightly problematic if someone inherits
from QTabBar. In this case, if you inherit from it, all that’ll happen is
that the new changeCurrentOnDrag property of the tabbar won’t work. For
detail have a look at 54ca39af in qtbase. IMO it’s ok to have this change.
Cheers,
Lars
More information about the Development
mailing list