[Interest] QGraphicsRotation in QGraphicsViewScene

Duan,Lin linduan at isoftstone.com
Wed Sep 12 11:19:26 CEST 2012


Hello list,

I want to Rotate my QGraphicsItem by the axis behind the screen. As graph follow:
[cid:image001.gif at 01CD9107.6082B5F0]

My code like this:

QGraphicsItem* m_item = new QGraphicsItem_subclass();
QGraphicsRotation* m_rotation = new QGraphicsRotation();;
QPropertyAnimation* m_animation = new QPropertyAnimation(NULL,"angle");;

m_rotation->setAxis(QVector3D(0.0, 1.0, 0.0));
m_rotation->setOrigin(QVector3D(m_item.boundingRect().width()/2, 0.0, 100.0));
m_item ->setTransformations(QList<QGraphicsTransform*>() << m_rotation);
m_animation->setTargetObject(m_rotation);



I found that it was not performed as expected,but :
[cid:image002.gif at 01CD9108.913FB610]

How can I do , so it can performed as expected (first graph)?


Thank you.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120912/2c3d4321/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 2275 bytes
Desc: image001.gif
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120912/2c3d4321/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.gif
Type: image/gif
Size: 2203 bytes
Desc: image002.gif
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120912/2c3d4321/attachment-0001.gif>


More information about the Interest mailing list