What about Property animation with GraphicsItem
-
Hello World!
Have 5.3.0
@
class myTextItem: public QObject, public QGraphicsTextItem
{
Q_OBJECT
Q_PROPERTY(QPointF newPos READ pos WRITE setPos)
Q_PROPERTY(qreal textWidth READ textWidth WRITE setTextWidth)
}
@
and compile
4x 'QObject' is an ambiguous base of 'myTextItem'P.S.0 http://qt-project.org/doc/qt-4.8/animation-overview.html
P.S.1 i think it posible only 4.8have any ideas?
-
The animation framework is still valid, and it works in exactly the same way in Qt 5, as it did in Qt 4.
In this case, instead of subclassing QObject, you can use QVariantAnimation class to animate your properties.
-
[quote author="sierdzio" date="1411976308"]The animation framework is still valid, and it works in exactly the same way in Qt 5, as it did in Qt 4.
In this case, instead of subclassing QObject, you can use QVariantAnimation class to animate your properties.[/quote]
xmmm
you offer subclassing of QVariantAnimation?
or
only "public: QGraphicsTextItem"and in main instead QPropertyAnimation use QVariantAnimation?
=D in first case i still get ‘QObject’ is an ambiguous base of ‘myTextItem’
but now 2x -
I propose to go with the second option: only inherit from QGraphicsTextItem.
-
if only “public: QGraphicsTextItem”
and use macro Q_OBJECT
clean - rebuild
all work -
Do not use Q_OBJECT macro in there. Variant animation does not need it. Remove Q_PROPERTY macros, too.
-
wherefore QVariantAnimation better?
if add that macro i can use QPropertyAnimation (i think it simple for use
and more flexibly if use property)but i newbie and i wait you answer =)
-
QPropertyAnimation class, Q_OBJECT and Q_PROPERTY macros are reserved for QObjects. If it works for you without a QObject, well, I am surprised - it shouldn't, but you can probably leave it as it is.