Nominate our 2022 Qt Champions!

Re: QGraphicsItemAnimation

  • What is the point of putting in the "documentation" that an item is "deprecated" when you don't even bother to indicate the intended replacement to someone searching for such functionality?

  • Correct, even if I think there is at least an indication:

    bq. For individual item animation, an alternative to this function is to either use QGraphicsItemAnimation, or to multiple-inherit from QObject and QGraphicsItem, and animate your item using QObject::startTimer() and QObject::timerEvent().

    So the meaning should be that the QGraphicsItemAnimation should not be used any more in favor of QObject + QGraphicsItem. The deal should be that there is no replacement for such a class.

  • An alternative to QGraphicsItemAnimation (which is a class, not a function) is QGraphicsItemAnimation?

    The documentation for this class is here:

    The word alternative doesn't appear on that page, so I don't know what you are quoting. It just says it's deprecated, and leaves the user to fend for himself. To say there is no replacement would mean there is no way to animate such an object, which is not the case.

    I was able to use QPropertyAnimation. If the deprecation notice had indicated this (or something else) as an alternative, then it would have saved me the time of finding it myself--and given me the assurance that this was the best alternative (the latter being something I still don't have).

  • Well, I was reading the documentation about the "advance": method of QGraphicsItem, as an example.

  • I guess (not: know), that "this section": might be the key:
    Graphics View supports animation at several levels. You can easily assemble animation by using the Animation Framework. For that you'll need your items to inherit from QGraphicsObject and associate QPropertyAnimation with them. QPropertyAnimation allows to animate any QObject property.[/quote]

    So, instead of using the specialized graphics view animation framework, you use the more general Qt animation framework.

Log in to reply