0
我有从QGraphicsItem
派生的类。它包含的点的矢量WICH我在涂料绘制:使用_vertexes
更改boundingRect后QGraphicsItem的位置
for(int i = 0; i < _vertexes.size(); i++)
{
...
painter->drawEllipse(_vertexes[i], POINT_RADIUS, POINT_RADIUS);
}
当我在_vertexes
在视图中添加点与该代码点的
prepareGeometryChange();
_vertexes.pop_back();
位置是变化的,boundingRect
计算
如何保存积分位置?如果新增boundingRect
较大,我不希望所有积分在添加新积分后改变位置。通过pos()
返回始终相同的位置(0,0),但它可能位于屏幕的不同位置。
听起来好像当边界矩形改变而不是实际改变位置时QGraphicsScene在'QGraphicsView'中滚动。尝试设置场景rect ['explicit'](http://doc.qt.io/qt-5/qgraphicsview.html#sceneRect-prop)。 –
谢谢,sceneRect的设置帮助我解决问题 –