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))
{
piece->RefreshGeometry(true); // Refresh internal paths
piece->RefreshGeometry();
QApplication::processEvents();
}
updatePieces.clear();

View File

@ -62,6 +62,7 @@
#include <QKeyEvent>
#include <QMenu>
#include <QMessageBox>
#include <QTimer>
// 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());