为什么QGraphicsItem的位置即使在变换时也是如此?

时间:2015-03-08 11:02:00

标签: c++ qt qgraphicsitem

This is picture of rotated Item

我正在研究图形项目我有一个查询,当我围绕X轴旋转QGraphicsItem时,它的左下角x位置和顶部x位置返回相同的值。

当我打印sceneBoundingRect().topLeft().x()sceneBoundingRect().bottomLeft().x()时,两个值都相同,但在视觉上它会有一些变化。
为此,我在其QGraphicsRectItem周围绘制了sceneBoundingRect。 为什么会这样? 这是我的代码

QTransform trans;
trans.translate(boundingRect().width()/2,boundingRect().height()/2);
trans.rotate(value, Qt::XAxis);
trans.translate(-boundingRect().width()/2,-boundingRect().height()/2);
setTransform(trans);

0 个答案:

没有答案