Allow user add points in list by clicking on label.

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2015-03-19 15:02:39 +02:00
parent 7fccb9eb63
commit 37dbe31050
4 changed files with 14 additions and 1 deletions

View File

@ -53,6 +53,7 @@ VToolPoint::VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsIte
namePoint = new VGraphicsSimpleTextItem(this);
connect(namePoint, &VGraphicsSimpleTextItem::ShowContextMenu, this, &VToolPoint::ShowContextMenu);
connect(namePoint, &VGraphicsSimpleTextItem::DeleteTool, this, &VToolPoint::DeleteFromLabel);
connect(namePoint, &VGraphicsSimpleTextItem::PointChoosed, this, &VToolPoint::PointChoosed);
lineName = new QGraphicsLineItem(this);
connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VToolPoint::NameChangePosition);
this->setBrush(QBrush(Qt::NoBrush));
@ -199,6 +200,12 @@ void VToolPoint::EnableToolMove(bool move)
namePoint->setFlag(QGraphicsItem::ItemIsMovable, move);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPoint::PointChoosed()
{
emit ChoosedTool(id, SceneObject::Point);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief mouseReleaseEvent handle mouse release events.
@ -208,7 +215,7 @@ void VToolPoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
if (event->button() == Qt::LeftButton)
{
emit ChoosedTool(id, SceneObject::Point);
PointChoosed();
}
QGraphicsEllipseItem::mouseReleaseEvent(event);
}

View File

@ -60,6 +60,7 @@ public slots:
void Disable(bool disable);
void DeleteFromLabel();
virtual void EnableToolMove(bool move);
void PointChoosed();
protected:
/** @brief radius radius circle. */
qreal radius;

View File

@ -183,6 +183,10 @@ void VGraphicsSimpleTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
VApplication::restoreOverrideCursor(cursorArrowCloseHand);
}
}
else
{
emit PointChoosed();
}
QGraphicsSimpleTextItem::mouseReleaseEvent(event);
}

View File

@ -61,6 +61,7 @@ signals:
*/
void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
void DeleteTool();
void PointChoosed();
protected:
QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent *event );