我正在研究图形项目我有一个查询,当我围绕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);