How to update current QQuickItem's transform with c++?
Solved
QML and Qt Quick
-
QQucikItem has a
updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData * data)
interface,
Can i use thedata->transformNode
as current item's transform?
i'am trying something like:QSGNode *BaseItem::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData * data) { QSGTransformNode *transformNode = data->transformNode; if ( move ) { qDebug()<< "move..."; QMatrix4x4 rotationMatrix; rotationMatrix.translate(width()/2, height()/2); rotationMatrix.rotate(20, QVector3D(0,0,1)); rotationMatrix.translate(-width()/2, -height()/2); transformNode->setMatrix( rotationMatrix * transformNode->matrix() ); transformNode->markDirty( QSGNode::DirtyMatrix ); } return oldNode; }
the item does not get rotated.