diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 703042feb..76778b45c 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -172,6 +172,7 @@ void VPattern::Parse(const Document &parse) break; } + m_parsing = true; SCASSERT(sceneDraw != nullptr) SCASSERT(sceneDetail != nullptr) static const QStringList tags({TagDraw, TagIncrements, TagPreviewCalculations}); @@ -238,6 +239,7 @@ void VPattern::Parse(const Document &parse) RefreshPieceGeometry(); } emit CheckLayout(); + m_parsing = false; } //--------------------------------------------------------------------------------------------------------------------- @@ -3576,10 +3578,25 @@ quint32 VPattern::LastToolId() const //--------------------------------------------------------------------------------------------------------------------- void VPattern::RefreshPieceGeometry() { + if (qApp->IsGUIMode() && m_parsing) + { + return; + } + for(auto piece : qAsConst(updatePieces)) { + if (qApp->IsGUIMode() && m_parsing) + { + return; + } + piece->RefreshGeometry(); QApplication::processEvents(); + + if (qApp->IsGUIMode() && m_parsing) + { + return; + } } updatePieces.clear(); VMainGraphicsView::NewSceneRect(sceneDetail, qApp->getSceneView()); diff --git a/src/app/valentina/xml/vpattern.h b/src/app/valentina/xml/vpattern.h index 2a78d62c5..cc115f7f3 100644 --- a/src/app/valentina/xml/vpattern.h +++ b/src/app/valentina/xml/vpattern.h @@ -138,6 +138,11 @@ private: VMainGraphicsScene *sceneDetail; QVector updatePieces; + /** + * @brief m_parsing true if parsing a pattern. Helps to stop updating piece when new parsing happend before + * finish */ + bool m_parsing{false}; + VNodeDetail ParseDetailNode(const QDomElement &domElement) const; void ParseDrawElement(const QDomNode& node, const Document &parse);