Merged in ValentinaZhuravska/valentina/feature (pull request #86)

Resolved issue #271

--HG--
branch : develop
This commit is contained in:
Roman Telezhinskyi 2015-12-21 11:34:59 +02:00
commit dfe5c0c601
3 changed files with 21 additions and 4 deletions

View File

@ -294,6 +294,5 @@ void VNodePoint::RefreshLine()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VNodePoint::EnableToolMove(bool move) void VNodePoint::EnableToolMove(bool move)
{ {
this->setFlag(QGraphicsItem::ItemIsMovable, move);
namePoint->setFlag(QGraphicsItem::ItemIsMovable, move); namePoint->setFlag(QGraphicsItem::ItemIsMovable, move);
} }

View File

@ -105,6 +105,8 @@ VToolDetail::VToolDetail(VAbstractPattern *doc, VContainer *data, const quint32
RefreshGeometry(); RefreshGeometry();
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
this->setFlag(QGraphicsItem::ItemIsFocusable, true); this->setFlag(QGraphicsItem::ItemIsFocusable, true);
connect(scene, &VMainGraphicsScene::EnableToolMove, this, &VToolDetail::EnableToolMove);
if (typeCreation == Source::FromGui || typeCreation == Source::FromTool) if (typeCreation == Source::FromGui || typeCreation == Source::FromTool)
{ {
AddToFile(); AddToFile();
@ -426,23 +428,32 @@ void VToolDetail::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void VToolDetail::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VToolDetail::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
if (flags() & QGraphicsItem::ItemIsMovable)
{
SetOverrideCursor(cursorArrowOpenHand, 1, 1); SetOverrideCursor(cursorArrowOpenHand, 1, 1);
} }
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolDetail::hoverEnterEvent(QGraphicsSceneHoverEvent *event) void VToolDetail::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
if (flags() & QGraphicsItem::ItemIsMovable)
{
SetOverrideCursor(cursorArrowOpenHand, 1, 1); SetOverrideCursor(cursorArrowOpenHand, 1, 1);
} }
}
////--------------------------------------------------------------------------------------------------------------------- ////---------------------------------------------------------------------------------------------------------------------
void VToolDetail::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VToolDetail::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
//Disable cursor-arrow-openhand //Disable cursor-arrow-openhand
if (flags() & QGraphicsItem::ItemIsMovable)
{
RestoreOverrideCursor(cursorArrowOpenHand); RestoreOverrideCursor(cursorArrowOpenHand);
} }
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
@ -607,3 +618,9 @@ void VToolDetail::InitTool(VMainGraphicsScene *scene, const VNodeDetail &node)
tool->setParentItem(this); tool->setParentItem(this);
doc->IncrementReferens(node.getId()); doc->IncrementReferens(node.getId());
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolDetail::EnableToolMove(bool move)
{
this->setFlag(QGraphicsItem::ItemIsMovable, move);
}

View File

@ -89,6 +89,7 @@ public:
public slots: public slots:
virtual void FullUpdateFromFile () Q_DECL_OVERRIDE; virtual void FullUpdateFromFile () Q_DECL_OVERRIDE;
virtual void FullUpdateFromGuiOk(int result); virtual void FullUpdateFromGuiOk(int result);
void EnableToolMove(bool move);
protected: protected:
virtual void AddToFile () Q_DECL_OVERRIDE; virtual void AddToFile () Q_DECL_OVERRIDE;
virtual void RefreshDataInFile() Q_DECL_OVERRIDE; virtual void RefreshDataInFile() Q_DECL_OVERRIDE;