Block moving point label if tool is active.
--HG-- branch : release
This commit is contained in:
parent
c77b165cf0
commit
f1b7726646
|
@ -328,6 +328,7 @@ VToolAlongLine* VToolAlongLine::Create(const quint32 _id, const QString &pointNa
|
|||
connect(point, &VToolAlongLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolAlongLine::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolAlongLine::Disable);
|
||||
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolAlongLine::EnableToolMove);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(firstPointId);
|
||||
doc->IncrementReferens(secondPointId);
|
||||
|
|
|
@ -209,6 +209,7 @@ VToolBisector* VToolBisector::Create(const quint32 _id, QString &formula, const
|
|||
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolBisector::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolBisector::Disable);
|
||||
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolBisector::EnableToolMove);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(firstPointId);
|
||||
doc->IncrementReferens(secondPointId);
|
||||
|
|
|
@ -136,6 +136,7 @@ VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(const quint32 _id, cons
|
|||
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolCurveIntersectAxis::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolCurveIntersectAxis::Disable);
|
||||
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolCurveIntersectAxis::EnableToolMove);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(basePointId);
|
||||
doc->IncrementReferens(curveId);
|
||||
|
|
|
@ -174,6 +174,7 @@ VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QS
|
|||
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolCutArc::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolCutArc::Disable);
|
||||
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolCutArc::EnableToolMove);
|
||||
doc->AddTool(id, point);
|
||||
doc->AddTool(arc1id, point);
|
||||
doc->AddTool(arc2id, point);
|
||||
|
|
|
@ -183,6 +183,7 @@ VToolCutSpline* VToolCutSpline::Create(const quint32 _id, const QString &pointNa
|
|||
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolCutSpline::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolCutSpline::Disable);
|
||||
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolCutSpline::EnableToolMove);
|
||||
doc->AddTool(id, point);
|
||||
doc->AddTool(spl1id, point);
|
||||
doc->AddTool(spl2id, point);
|
||||
|
|
|
@ -231,6 +231,7 @@ VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString
|
|||
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolCutSplinePath::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolCutSplinePath::Disable);
|
||||
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolCutSplinePath::EnableToolMove);
|
||||
doc->AddTool(id, point);
|
||||
doc->AddTool(splPath1id, point);
|
||||
doc->AddTool(splPath2id, point);
|
||||
|
|
|
@ -173,6 +173,7 @@ VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName,
|
|||
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolEndLine::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolEndLine::Disable);
|
||||
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolEndLine::EnableToolMove);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(basePointId);
|
||||
return point;
|
||||
|
|
|
@ -169,6 +169,7 @@ VToolHeight* VToolHeight::Create(const quint32 _id, const QString &pointName, co
|
|||
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolHeight::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolHeight::Disable);
|
||||
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolHeight::EnableToolMove);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(basePointId);
|
||||
doc->IncrementReferens(p1LineId);
|
||||
|
|
|
@ -176,6 +176,7 @@ VToolLineIntersect* VToolLineIntersect::Create(const quint32 _id, const quint32
|
|||
connect(point, &VToolLineIntersect::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolLineIntersect::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolLineIntersect::Disable);
|
||||
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolLineIntersect::EnableToolMove);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(p1Line1Id);
|
||||
doc->IncrementReferens(p2Line1Id);
|
||||
|
|
|
@ -148,6 +148,7 @@ VToolLineIntersectAxis *VToolLineIntersectAxis::Create(const quint32 _id, const
|
|||
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolLineIntersectAxis::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolLineIntersectAxis::Disable);
|
||||
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolLineIntersectAxis::EnableToolMove);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(basePointId);
|
||||
doc->IncrementReferens(firstPointId);
|
||||
|
|
|
@ -169,6 +169,7 @@ VToolNormal* VToolNormal::Create(const quint32 _id, QString &formula, const quin
|
|||
connect(point, &VToolNormal::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolNormal::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolNormal::Disable);
|
||||
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolNormal::EnableToolMove);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(firstPointId);
|
||||
doc->IncrementReferens(secondPointId);
|
||||
|
|
|
@ -193,6 +193,12 @@ void VToolPoint::DeleteFromLabel()
|
|||
DeleteTool(); //Leave this method immediately after call!!!
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPoint::EnableToolMove(bool move)
|
||||
{
|
||||
namePoint->setFlag(QGraphicsItem::ItemIsMovable, move);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief mouseReleaseEvent handle mouse release events.
|
||||
|
|
|
@ -59,6 +59,7 @@ public slots:
|
|||
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
|
||||
void Disable(bool disable);
|
||||
void DeleteFromLabel();
|
||||
virtual void EnableToolMove(bool move);
|
||||
protected:
|
||||
/** @brief radius radius circle. */
|
||||
qreal radius;
|
||||
|
|
|
@ -210,6 +210,7 @@ VToolPointOfContact* VToolPointOfContact::Create(const quint32 _id, QString &rad
|
|||
connect(point, &VToolPointOfContact::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPointOfContact::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolPointOfContact::Disable);
|
||||
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolPointOfContact::EnableToolMove);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(center);
|
||||
doc->IncrementReferens(firstPointId);
|
||||
|
|
|
@ -151,6 +151,7 @@ VToolPointOfIntersection *VToolPointOfIntersection::Create(const quint32 _id, co
|
|||
connect(point, &VToolPointOfIntersection::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPointOfIntersection::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolPointOfIntersection::Disable);
|
||||
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolPointOfIntersection::EnableToolMove);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(firstPointId);
|
||||
doc->IncrementReferens(secondPointId);
|
||||
|
|
|
@ -213,6 +213,7 @@ VToolShoulderPoint* VToolShoulderPoint::Create(const quint32 _id, QString &formu
|
|||
connect(point, &VToolShoulderPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolShoulderPoint::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolShoulderPoint::Disable);
|
||||
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolShoulderPoint::EnableToolMove);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(p1Line);
|
||||
doc->IncrementReferens(p2Line);
|
||||
|
|
|
@ -350,4 +350,5 @@ void VToolSinglePoint::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
|
|||
void VToolSinglePoint::EnableToolMove(bool move)
|
||||
{
|
||||
this->setFlag(QGraphicsItem::ItemIsMovable, move);
|
||||
VToolPoint::EnableToolMove(move);
|
||||
}
|
||||
|
|
|
@ -162,6 +162,7 @@ VToolTriangle* VToolTriangle::Create(const quint32 _id, const QString &pointName
|
|||
connect(point, &VToolTriangle::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolTriangle::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolTriangle::Disable);
|
||||
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolTriangle::EnableToolMove);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(axisP1Id);
|
||||
doc->IncrementReferens(axisP2Id);
|
||||
|
|
|
@ -122,9 +122,12 @@ QVariant VGraphicsSimpleTextItem::itemChange(GraphicsItemChange change, const QV
|
|||
*/
|
||||
void VGraphicsSimpleTextItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
if (flags() & QGraphicsItem::ItemIsMovable)
|
||||
{
|
||||
this->setBrush(Qt::green);
|
||||
|
||||
VApplication::setOverrideCursor(cursorArrowOpenHand, 1, 1);
|
||||
}
|
||||
QGraphicsSimpleTextItem::hoverEnterEvent(event);
|
||||
}
|
||||
|
||||
|
@ -136,10 +139,13 @@ void VGraphicsSimpleTextItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
|||
void VGraphicsSimpleTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
if (flags() & QGraphicsItem::ItemIsMovable)
|
||||
{
|
||||
this->setBrush(Qt::black);
|
||||
|
||||
//Disable cursor-arrow-openhand
|
||||
VApplication::restoreOverrideCursor(cursorArrowOpenHand);
|
||||
}
|
||||
QGraphicsSimpleTextItem::hoverLeaveEvent(event);
|
||||
}
|
||||
|
||||
|
@ -156,21 +162,27 @@ void VGraphicsSimpleTextItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *e
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VGraphicsSimpleTextItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (flags() & QGraphicsItem::ItemIsMovable)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||
{
|
||||
VApplication::setOverrideCursor(cursorArrowCloseHand, 1, 1);
|
||||
}
|
||||
}
|
||||
QGraphicsSimpleTextItem::mousePressEvent(event);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VGraphicsSimpleTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (flags() & QGraphicsItem::ItemIsMovable)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||
{
|
||||
//Disable cursor-arrow-closehand
|
||||
VApplication::restoreOverrideCursor(cursorArrowCloseHand);
|
||||
}
|
||||
}
|
||||
QGraphicsSimpleTextItem::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user