Allow user add points in list by clicking on label.
--HG-- branch : release
This commit is contained in:
parent
7fccb9eb63
commit
37dbe31050
|
@ -53,6 +53,7 @@ VToolPoint::VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsIte
|
||||||
namePoint = new VGraphicsSimpleTextItem(this);
|
namePoint = new VGraphicsSimpleTextItem(this);
|
||||||
connect(namePoint, &VGraphicsSimpleTextItem::ShowContextMenu, this, &VToolPoint::ShowContextMenu);
|
connect(namePoint, &VGraphicsSimpleTextItem::ShowContextMenu, this, &VToolPoint::ShowContextMenu);
|
||||||
connect(namePoint, &VGraphicsSimpleTextItem::DeleteTool, this, &VToolPoint::DeleteFromLabel);
|
connect(namePoint, &VGraphicsSimpleTextItem::DeleteTool, this, &VToolPoint::DeleteFromLabel);
|
||||||
|
connect(namePoint, &VGraphicsSimpleTextItem::PointChoosed, this, &VToolPoint::PointChoosed);
|
||||||
lineName = new QGraphicsLineItem(this);
|
lineName = new QGraphicsLineItem(this);
|
||||||
connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VToolPoint::NameChangePosition);
|
connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VToolPoint::NameChangePosition);
|
||||||
this->setBrush(QBrush(Qt::NoBrush));
|
this->setBrush(QBrush(Qt::NoBrush));
|
||||||
|
@ -199,6 +200,12 @@ void VToolPoint::EnableToolMove(bool move)
|
||||||
namePoint->setFlag(QGraphicsItem::ItemIsMovable, move);
|
namePoint->setFlag(QGraphicsItem::ItemIsMovable, move);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolPoint::PointChoosed()
|
||||||
|
{
|
||||||
|
emit ChoosedTool(id, SceneObject::Point);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief mouseReleaseEvent handle mouse release events.
|
* @brief mouseReleaseEvent handle mouse release events.
|
||||||
|
@ -208,7 +215,7 @@ void VToolPoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (event->button() == Qt::LeftButton)
|
if (event->button() == Qt::LeftButton)
|
||||||
{
|
{
|
||||||
emit ChoosedTool(id, SceneObject::Point);
|
PointChoosed();
|
||||||
}
|
}
|
||||||
QGraphicsEllipseItem::mouseReleaseEvent(event);
|
QGraphicsEllipseItem::mouseReleaseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,7 @@ public slots:
|
||||||
void Disable(bool disable);
|
void Disable(bool disable);
|
||||||
void DeleteFromLabel();
|
void DeleteFromLabel();
|
||||||
virtual void EnableToolMove(bool move);
|
virtual void EnableToolMove(bool move);
|
||||||
|
void PointChoosed();
|
||||||
protected:
|
protected:
|
||||||
/** @brief radius radius circle. */
|
/** @brief radius radius circle. */
|
||||||
qreal radius;
|
qreal radius;
|
||||||
|
|
|
@ -183,6 +183,10 @@ void VGraphicsSimpleTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
VApplication::restoreOverrideCursor(cursorArrowCloseHand);
|
VApplication::restoreOverrideCursor(cursorArrowCloseHand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
emit PointChoosed();
|
||||||
|
}
|
||||||
QGraphicsSimpleTextItem::mouseReleaseEvent(event);
|
QGraphicsSimpleTextItem::mouseReleaseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ signals:
|
||||||
*/
|
*/
|
||||||
void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
|
void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
|
||||||
void DeleteTool();
|
void DeleteTool();
|
||||||
|
void PointChoosed();
|
||||||
protected:
|
protected:
|
||||||
QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
|
QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
|
||||||
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent *event );
|
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent *event );
|
||||||
|
|
Loading…
Reference in New Issue
Block a user