A QWidget
as a paintEvent
function which is responsible of his drawing. To implement correctly this function, a QStyle
object is used to represent each component and a QStyleOption
object to save the status of the control.
E.g: A custom ScrollBar
implement his paintEvent
, which call drawComplexControl
with the option "CC_ScrollBar
". Then, QProxyStyle
could be extended to change the appearance of the scroll-bar.
When the user hover the slider, paintEvent
is called which apply the new "hovered" appearance, which state is saved in the QStyleOption::state
. But for now a day widgets, this state should not be updated instantly, but with a smooth transition (animation) over some 100-500 milliseconds. In order to animate the widget with this transition some values are needed, like the current state of the animation (a qreal
/QColor
?) for each part of the scroll: top arrow, bottom arrow or slider.
After this "long" introduction, my question come:
Is there a variable somewhere to set the state of this animation? I could extend QStyleOption
with this new value, but the current implementation already seem to include animation, I am unable to found where this transition state is saved.
I am looking for a canonical answer.
Note: To avoid "possible duplicate of...", even if slightly related, this is NOT a question about how to use QAnimation or creating custom Widgets.