[Qt-interest] Using QAbstractAnimation as a base class: questions
Adenilson Cavalcanti
cavalcantii at gmail.com
Thu Dec 3 17:59:11 CET 2009
Friends
I'm writing to ask for some help concerning using QAbstractAnimation
as a base of a specialized class. I had read the documentation and
tried to google for it (but since the new and shiny Qt 4.6 animation
framework is quite new, I didn't got any significant results). So the
questions are:
a) Which functions should be (re)implemented if you use
QAbstractAnimation as a class? I've implemented the following:
duration, setDuration, updateDirection, updateCurrentTime. Is there
any other recommend function that just/should be implemented?
b) I noticed that the 'start' slot is not being called currently in my
derived class if it is inserted in an animation group (I expected that
by adding an animation object in a group, it would have its start slot
automagically called). Currently, I implemented a hack where in
'updateCurrentTime' I explicitly call the start slot, but I wonder if
is there a better way?
c) Another question is that 'updateCurrentTime' seems to be called
only when the animation is inside of an animation group, but not if
the animation has being started alone (i.e. the start slot connected
to the clicked signal of a button). Is this the expected behavior or
not, and why?
d) This one is about design: say that I have a class that will have to
animate a property of the target widget (and I have to use as the base
an abstract class that already inherits from QAbstractAnimation).
Which would yield a better design: to have a class member instance of
a QPropertyAnimation or inherit from both classes? I think in the
second choice the class would have 2 actual instances of
QAbstractAnimation, since QPropertyAnimation already uses
QAbstractAnimation (bloat++). The second design option requires to
create explicitly a QPropertyAnimation instance (which is somewhat
cumbersome). Anyone could comment on this?
I guess this is more than enough for a first post...
:-)
Best regards
Adenilson Cavalcanti
a.k.a. Savago
More information about the Qt-interest-old
mailing list