Skip to content

Commit

Permalink
Fixes #3708. Call prepareGeometryChange to avoid unnecessary paint ev…
Browse files Browse the repository at this point in the history
…ents.
  • Loading branch information
adeas31 committed Feb 23, 2016
1 parent a560950 commit 9106a0c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions OMEdit/OMEditGUI/Annotations/LineAnnotation.cpp
Expand Up @@ -495,6 +495,7 @@ QString LineAnnotation::getTLMShapeAnnotation()

void LineAnnotation::addPoint(QPointF point)
{
prepareGeometryChange();
mPoints.append(point);
if (mPoints.size() > 1) {
if (mGeometries.size() == 0) {
Expand All @@ -513,6 +514,7 @@ void LineAnnotation::addPoint(QPointF point)

void LineAnnotation::removePoint(int index)
{
prepareGeometryChange();
if (mPoints.size() > index) {
mPoints.removeAt(index);
}
Expand Down Expand Up @@ -547,6 +549,7 @@ void LineAnnotation::clearPoints()
*/
void LineAnnotation::updateStartPoint(QPointF point)
{
prepareGeometryChange();
manhattanizeShape();
removeRedundantPointsGeometriesAndCornerItems();
qreal dx = point.x() - mPoints[0].x();
Expand Down Expand Up @@ -584,6 +587,7 @@ void LineAnnotation::updateStartPoint(QPointF point)
*/
void LineAnnotation::updateEndPoint(QPointF point)
{
prepareGeometryChange();
if (mLineType == LineAnnotation::ConnectionType) {
if (!mpGraphicsView->isCreatingConnection()) {
manhattanizeShape();
Expand Down Expand Up @@ -630,6 +634,7 @@ void LineAnnotation::updateEndPoint(QPointF point)

void LineAnnotation::moveAllPoints(qreal offsetX, qreal offsetY)
{
prepareGeometryChange();
for(int i = 0 ; i < mPoints.size() ; i++) {
mPoints[i] = QPointF(mPoints[i].x()+offsetX, mPoints[i].y()+offsetY);
/* updated the corresponding CornerItem */
Expand Down Expand Up @@ -658,6 +663,7 @@ void LineAnnotation::setShapeFlags(bool enable)

void LineAnnotation::updateShape(ShapeAnnotation *pShapeAnnotation)
{
prepareGeometryChange();
LineAnnotation *pLineAnnotation = dynamic_cast<LineAnnotation*>(pShapeAnnotation);
setLineType(pLineAnnotation->getLineType());
setStartComponent(pLineAnnotation->getStartComponent());
Expand Down

0 comments on commit 9106a0c

Please sign in to comment.