Optimization. Delay refresh a piece internals update.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-02-23 13:24:41 +02:00
parent bafb7ff70a
commit 73885ea890
2 changed files with 27 additions and 7 deletions

View File

@ -3578,7 +3578,7 @@ void VPattern::RefreshPieceGeometry()
{ {
for(auto piece : qAsConst(updatePieces)) for(auto piece : qAsConst(updatePieces))
{ {
piece->RefreshGeometry(true); // Refresh internal paths piece->RefreshGeometry();
QApplication::processEvents(); QApplication::processEvents();
} }
updatePieces.clear(); updatePieces.clear();

View File

@ -62,6 +62,7 @@
#include <QKeyEvent> #include <QKeyEvent>
#include <QMenu> #include <QMenu>
#include <QMessageBox> #include <QMessageBox>
#include <QTimer>
// Current version of seam allowance tag need for backward compatibility // Current version of seam allowance tag need for backward compatibility
const quint8 VToolSeamAllowance::pieceVersion = 2; const quint8 VToolSeamAllowance::pieceVersion = 2;
@ -1335,6 +1336,11 @@ void VToolSeamAllowance::RefreshGeometry(bool updateChildren)
m_seamAllowance->setPath(QPainterPath()); m_seamAllowance->setPath(QPainterPath());
} }
if (qApp->IsAppInGUIMode())
{
QTimer::singleShot(100, this, [this, updateChildren]()
{
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false);
UpdateDetailLabel(); UpdateDetailLabel();
UpdatePatternInfo(); UpdatePatternInfo();
UpdateGrainline(); UpdateGrainline();
@ -1343,6 +1349,20 @@ void VToolSeamAllowance::RefreshGeometry(bool updateChildren)
{ {
UpdateInternalPaths(); UpdateInternalPaths();
} }
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
});
}
else
{
UpdateDetailLabel();
UpdatePatternInfo();
UpdateGrainline();
UpdateExcludeState();
if (updateChildren)
{
UpdateInternalPaths();
}
}
m_passmarks->setPath(futurePassmarks.result()); m_passmarks->setPath(futurePassmarks.result());