Ich versuche derzeit ein QGraphicsItem in meinem QGraphicsView auf dessen Qt::YAxis zu drehen.
Ich kann zwar folgenden code kompilieren, jedoch geschieht einfach nichts sobald ich die entsprechende Funktion (functionBla()) abrufe.
--A.h--
Code: Alles auswählen
class myOwnPixmapItem : public QObject, public QGraphicsPixmapItem
{
Q_OBJECT
Q_PROPERTY (QTransform transform READ transform WRITE setTransform)
public:
myOwnPixmapItem();
myOwnPixmapItem *myGraphicsItem;
functionBla();
};
Code: Alles auswählen
myOwnPixmapItem::myOwnPixmapItem()
{
myGraphicsItem = new myOwnPixmapItem;
}
myOwnPixmapItem::functionBla()
{
QTransform trans;
trans.rotate (0, Qt::YAxis);
QPropertyAnimation* animation = new QPropertyAnimation (myGraphicsItem, "transform");
animation->setDuration(1400);
animation->setStartValue(trans);
trans.rotate (60, Qt::YAxis);
animation->setEndValue(trans);
animation->start();
}