After each reset label or grainline need to repaint piece image.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2017-01-18 14:01:51 +02:00
parent ccc8da800f
commit 004c83a11f
3 changed files with 14 additions and 2 deletions

View File

@ -32,6 +32,7 @@
#include <QGraphicsSceneMouseEvent> #include <QGraphicsSceneMouseEvent>
#include <QStyleOptionGraphicsItem> #include <QStyleOptionGraphicsItem>
#include <QDebug> #include <QDebug>
#include <QGraphicsScene>
#include "../vmisc/def.h" #include "../vmisc/def.h"
#include "../vmisc/vmath.h" #include "../vmisc/vmath.h"
@ -230,6 +231,10 @@ QRectF VGrainlineItem::boundingRect() const
*/ */
void VGrainlineItem::Reset() void VGrainlineItem::Reset()
{ {
if (QGraphicsScene *toolScene = scene())
{
toolScene->clearSelection();
}
m_bReleased = false; m_bReleased = false;
m_eMode = mNormal; m_eMode = mNormal;
setZValue(INACTIVE_Z); setZValue(INACTIVE_Z);

View File

@ -37,6 +37,7 @@
#include <QPoint> #include <QPoint>
#include <QStyleOptionGraphicsItem> #include <QStyleOptionGraphicsItem>
#include <Qt> #include <Qt>
#include <QGraphicsScene>
#include "../vmisc/def.h" #include "../vmisc/def.h"
#include "../vmisc/vmath.h" #include "../vmisc/vmath.h"
@ -201,6 +202,10 @@ void VTextGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
*/ */
void VTextGraphicsItem::Reset() void VTextGraphicsItem::Reset()
{ {
if (QGraphicsScene *toolScene = scene())
{
toolScene->clearSelection();
}
m_eMode = mNormal; m_eMode = mNormal;
m_bReleased = false; m_bReleased = false;
Update(); Update();

View File

@ -334,7 +334,7 @@ void VToolSeamAllowance::AllowSelecting(bool enabled)
void VToolSeamAllowance::ResetChildren(QGraphicsItem *pItem) void VToolSeamAllowance::ResetChildren(QGraphicsItem *pItem)
{ {
const VPiece detail = VAbstractTool::data.GetPiece(id); const VPiece detail = VAbstractTool::data.GetPiece(id);
VTextGraphicsItem* pVGI = dynamic_cast<VTextGraphicsItem*>(pItem); VTextGraphicsItem* pVGI = qgraphicsitem_cast<VTextGraphicsItem*>(pItem);
if (pVGI != m_dataLabel) if (pVGI != m_dataLabel)
{ {
if (detail.GetPatternPieceData().IsVisible()) if (detail.GetPatternPieceData().IsVisible())
@ -349,7 +349,7 @@ void VToolSeamAllowance::ResetChildren(QGraphicsItem *pItem)
m_patternInfo->Reset(); m_patternInfo->Reset();
} }
} }
VGrainlineItem* pGLI = dynamic_cast<VGrainlineItem*>(pItem); VGrainlineItem* pGLI = qgraphicsitem_cast<VGrainlineItem*>(pItem);
if (pGLI != m_grainLine) if (pGLI != m_grainLine)
{ {
if (detail.GetGrainlineGeometry().IsVisible()) if (detail.GetGrainlineGeometry().IsVisible())
@ -357,6 +357,8 @@ void VToolSeamAllowance::ResetChildren(QGraphicsItem *pItem)
m_grainLine->Reset(); m_grainLine->Reset();
} }
} }
update();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------