From 73885ea890a12bf340f0c985af26188b9487c900 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 23 Feb 2019 13:24:41 +0200 Subject: [PATCH] Optimization. Delay refresh a piece internals update. --HG-- branch : develop --- src/app/valentina/xml/vpattern.cpp | 2 +- src/libs/vtools/tools/vtoolseamallowance.cpp | 32 ++++++++++++++++---- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 4df13b4cb..f8346ef4b 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -3578,7 +3578,7 @@ void VPattern::RefreshPieceGeometry() { for(auto piece : qAsConst(updatePieces)) { - piece->RefreshGeometry(true); // Refresh internal paths + piece->RefreshGeometry(); QApplication::processEvents(); } updatePieces.clear(); diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index 4e09c6466..884707f53 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -62,6 +62,7 @@ #include #include #include +#include // Current version of seam allowance tag need for backward compatibility const quint8 VToolSeamAllowance::pieceVersion = 2; @@ -1335,13 +1336,32 @@ void VToolSeamAllowance::RefreshGeometry(bool updateChildren) m_seamAllowance->setPath(QPainterPath()); } - UpdateDetailLabel(); - UpdatePatternInfo(); - UpdateGrainline(); - UpdateExcludeState(); - if (updateChildren) + if (qApp->IsAppInGUIMode()) { - UpdateInternalPaths(); + QTimer::singleShot(100, this, [this, updateChildren]() + { + this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false); + UpdateDetailLabel(); + UpdatePatternInfo(); + UpdateGrainline(); + UpdateExcludeState(); + if (updateChildren) + { + UpdateInternalPaths(); + } + this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); + }); + } + else + { + UpdateDetailLabel(); + UpdatePatternInfo(); + UpdateGrainline(); + UpdateExcludeState(); + if (updateChildren) + { + UpdateInternalPaths(); + } } m_passmarks->setPath(futurePassmarks.result());