c++ - QGraphicsItem position after changing boundingRect -


i have class derived qgraphicsitem. contains vector of points wich draw in paint:

for(int = 0; < _vertexes.size(); i++) {      ...   painter->drawellipse(_vertexes[i], point_radius, point_radius); } 

when add point in _vertexes code

 preparegeometrychange();  _vertexes.pop_back(); 

position of points in view changing, boundingrect calculated using _vertexes

how save points positions? don't want points change position after adding new 1 if new boundingrect bigger. pos() returns same position (0, 0) in different position of screen.

i don't set initial scenerect, recalculated , scrolled after each increasing scene items bounding rect. setting scene rect ui->graphicsview->setscenerect(x, y, width, heigh); before adding of items solves problem,


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -