To speed up opening a pattern delay piece RafreshGeometry().
--HG-- branch : develop
This commit is contained in:
parent
5004c12342
commit
7c17b3629f
|
@ -67,6 +67,7 @@
|
||||||
#include <QtConcurrentMap>
|
#include <QtConcurrentMap>
|
||||||
#include <QFuture>
|
#include <QFuture>
|
||||||
#include <QtConcurrentRun>
|
#include <QtConcurrentRun>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
#ifdef Q_CC_MSVC
|
#ifdef Q_CC_MSVC
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
@ -91,7 +92,7 @@ void GatherCount(int &count, const int nodes)
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPattern::VPattern(VContainer *data, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, QObject *parent)
|
VPattern::VPattern(VContainer *data, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, QObject *parent)
|
||||||
: VAbstractPattern(parent), data(data), sceneDraw(sceneDraw), sceneDetail(sceneDetail)
|
: VAbstractPattern(parent), data(data), sceneDraw(sceneDraw), sceneDetail(sceneDetail), updatePieces()
|
||||||
{
|
{
|
||||||
SCASSERT(sceneDraw != nullptr)
|
SCASSERT(sceneDraw != nullptr)
|
||||||
SCASSERT(sceneDetail != nullptr)
|
SCASSERT(sceneDetail != nullptr)
|
||||||
|
@ -255,6 +256,7 @@ void VPattern::Parse(const Document &parse)
|
||||||
}
|
}
|
||||||
domNode = domNode.nextSibling();
|
domNode = domNode.nextSibling();
|
||||||
}
|
}
|
||||||
|
QTimer::singleShot(2000, Qt::VeryCoarseTimer, this, SLOT(RefreshPieceGeometry()));
|
||||||
emit CheckLayout();
|
emit CheckLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -877,7 +879,11 @@ void VPattern::ParseDetailElement(QDomElement &domElement, const Document &parse
|
||||||
initData.parse = parse;
|
initData.parse = parse;
|
||||||
initData.typeCreation = Source::FromFile;
|
initData.typeCreation = Source::FromFile;
|
||||||
|
|
||||||
VToolSeamAllowance::Create(initData);
|
VToolSeamAllowance *piece = VToolSeamAllowance::Create(initData);
|
||||||
|
if (parse == Document::FullParse)
|
||||||
|
{
|
||||||
|
updatePieces.append(piece);
|
||||||
|
}
|
||||||
//Rewrite attribute formula. Need for situation when we have wrong formula.
|
//Rewrite attribute formula. Need for situation when we have wrong formula.
|
||||||
if (w != initData.width)
|
if (w != initData.width)
|
||||||
{
|
{
|
||||||
|
@ -3507,6 +3513,17 @@ quint32 VPattern::LastToolId() const
|
||||||
return (not localHistory.isEmpty() ? localHistory.last().getId() : NULL_ID);
|
return (not localHistory.isEmpty() ? localHistory.last().getId() : NULL_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPattern::RefreshPieceGeometry()
|
||||||
|
{
|
||||||
|
for(auto piece : qAsConst(updatePieces))
|
||||||
|
{
|
||||||
|
piece->RefreshGeometry(true); // Refresh internal paths
|
||||||
|
}
|
||||||
|
updatePieces.clear();
|
||||||
|
VMainGraphicsView::NewSceneRect(sceneDetail, qApp->getSceneView());
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief ParseSplineElement parse spline tag.
|
* @brief ParseSplineElement parse spline tag.
|
||||||
|
|
|
@ -38,6 +38,7 @@ class VMainGraphicsScene;
|
||||||
class VNodeDetail;
|
class VNodeDetail;
|
||||||
struct VToolSinglePointInitData;
|
struct VToolSinglePointInitData;
|
||||||
struct VToolLinePointInitData;
|
struct VToolLinePointInitData;
|
||||||
|
class VToolSeamAllowance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The VPattern class working with pattern file.
|
* @brief The VPattern class working with pattern file.
|
||||||
|
@ -119,6 +120,9 @@ public slots:
|
||||||
protected:
|
protected:
|
||||||
virtual void customEvent(QEvent * event) override;
|
virtual void customEvent(QEvent * event) override;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void RefreshPieceGeometry();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VPattern)
|
Q_DISABLE_COPY(VPattern)
|
||||||
|
|
||||||
|
@ -127,6 +131,7 @@ private:
|
||||||
|
|
||||||
VMainGraphicsScene *sceneDraw;
|
VMainGraphicsScene *sceneDraw;
|
||||||
VMainGraphicsScene *sceneDetail;
|
VMainGraphicsScene *sceneDetail;
|
||||||
|
QVector<VToolSeamAllowance *> updatePieces;
|
||||||
|
|
||||||
VNodeDetail ParseDetailNode(const QDomElement &domElement) const;
|
VNodeDetail ParseDetailNode(const QDomElement &domElement) const;
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,6 @@ VToolSeamAllowance *VToolSeamAllowance::Create(VToolSeamAllowanceInitData &initD
|
||||||
initData.scene->addItem(piece);
|
initData.scene->addItem(piece);
|
||||||
VMainGraphicsView::NewSceneRect(initData.scene, qApp->getSceneView(), piece);
|
VMainGraphicsView::NewSceneRect(initData.scene, qApp->getSceneView(), piece);
|
||||||
VAbstractPattern::AddTool(initData.id, piece);
|
VAbstractPattern::AddTool(initData.id, piece);
|
||||||
piece->RefreshGeometry(true); // Refresh internal paths
|
|
||||||
}
|
}
|
||||||
//Very important to delete it. Only this tool need this special variable.
|
//Very important to delete it. Only this tool need this special variable.
|
||||||
initData.data->RemoveVariable(currentSeamAllowance);
|
initData.data->RemoveVariable(currentSeamAllowance);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user