Show context menu of tool on label.

--HG--
branch : develop
This commit is contained in:
dismine 2014-01-09 14:51:09 +02:00
parent d9a5296b34
commit 7b850afaea
26 changed files with 84 additions and 3 deletions

View file

@ -91,6 +91,11 @@ void VToolAlongLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
ContextMenu(dialogAlongLine, this, event);
}
void VToolAlongLine::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{
ContextMenu(dialogAlongLine, this, event);
}
void VToolAlongLine::AddToFile()
{
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);

View file

@ -106,12 +106,13 @@ public slots:
* @param factor
*/
virtual void SetFactor(qreal factor);
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected:
/**
* @brief contextMenuEvent
* @param event
*/
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
/**
* @brief AddToFile
*/

View file

@ -182,6 +182,11 @@ void VToolBisector::SetFactor(qreal factor)
RefreshGeometry();
}
void VToolBisector::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{
ContextMenu(dialogBisector, this, event);
}
void VToolBisector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
ContextMenu(dialogBisector, this, event);

View file

@ -119,6 +119,7 @@ public slots:
* @param factor
*/
virtual void SetFactor(qreal factor);
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected:
/**
* @brief contextMenuEvent

View file

@ -151,6 +151,11 @@ void VToolEndLine::FullUpdateFromGui(int result)
dialogEndLine.clear();
}
void VToolEndLine::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{
ContextMenu(dialogEndLine, this, event);
}
void VToolEndLine::AddToFile()
{
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);

View file

@ -101,6 +101,7 @@ public slots:
* @param result
*/
virtual void FullUpdateFromGui(int result);
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected:
/**
* @brief contextMenuEvent

View file

@ -166,6 +166,11 @@ void VToolHeight::FullUpdateFromGui(int result)
dialogHeight.clear();
}
void VToolHeight::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{
ContextMenu(dialogHeight, this, event);
}
void VToolHeight::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
ContextMenu(dialogHeight, this, event);

View file

@ -108,6 +108,7 @@ public slots:
* @param result
*/
virtual void FullUpdateFromGui(int result);
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected:
/**
* @brief contextMenuEvent

View file

@ -163,6 +163,11 @@ void VToolLineIntersect::SetFactor(qreal factor)
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
}
void VToolLineIntersect::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{
ContextMenu(dialogLineIntersect, this, event);
}
void VToolLineIntersect::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
ContextMenu(dialogLineIntersect, this, event);

View file

@ -106,6 +106,7 @@ public slots:
* @param factor
*/
virtual void SetFactor(qreal factor);
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected:
/**
* @brief contextMenuEvent

View file

@ -167,6 +167,11 @@ void VToolNormal::SetFactor(qreal factor)
RefreshGeometry();
}
void VToolNormal::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{
ContextMenu(dialogNormal, this, event);
}
void VToolNormal::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
ContextMenu(dialogNormal, this, event);

View file

@ -120,6 +120,7 @@ public slots:
* @param factor
*/
virtual void SetFactor(qreal factor);
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected:
/**
* @brief contextMenuEvent

View file

@ -34,11 +34,13 @@ VToolPoint::VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphics
QGraphicsEllipseItem(parent), radius(toPixel(2)), namePoint(0), lineName(0)
{
namePoint = new VGraphicsSimpleTextItem(this);
Q_ASSERT(namePoint != 0);
connect(namePoint, &VGraphicsSimpleTextItem::ShowContextMenu, this, &VToolPoint::ShowContextMenu);
namePoint->setBrush(Qt::black);
lineName = new QGraphicsLineItem(this);
Q_ASSERT(lineName != 0);
lineName->setPen(QPen(Qt::black));
connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this,
&VToolPoint::NameChangePosition);
connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VToolPoint::NameChangePosition);
this->setBrush(QBrush(Qt::NoBrush));
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
this->setFlag(QGraphicsItem::ItemIsFocusable, true);
@ -105,6 +107,11 @@ void VToolPoint::SetFactor(qreal factor)
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
}
void VToolPoint::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{
Q_UNUSED(event);
}
void VToolPoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
if (event->button() == Qt::LeftButton)

View file

@ -80,6 +80,7 @@ public slots:
* @param factor
*/
virtual void SetFactor(qreal factor);
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected:
/**
* @brief radius

View file

@ -186,6 +186,11 @@ void VToolPointOfContact::SetFactor(qreal factor)
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
}
void VToolPointOfContact::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{
ContextMenu(dialogPointOfContact, this, event);
}
void VToolPointOfContact::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
ContextMenu(dialogPointOfContact, this, event);

View file

@ -116,6 +116,7 @@ public slots:
* @param factor
*/
virtual void SetFactor(qreal factor);
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected:
/**
* @brief contextMenuEvent

View file

@ -128,6 +128,11 @@ void VToolPointOfIntersection::FullUpdateFromGui(int result)
dialogPointOfIntersection.clear();
}
void VToolPointOfIntersection::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{
ContextMenu(dialogPointOfIntersection, this, event);
}
void VToolPointOfIntersection::RemoveReferens()
{
doc->DecrementReferens(firstPointId);

View file

@ -97,6 +97,7 @@ public slots:
* @param result
*/
virtual void FullUpdateFromGui(int result);
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected:
/**
* @brief RemoveReferens

View file

@ -190,6 +190,11 @@ void VToolShoulderPoint::SetFactor(qreal factor)
RefreshGeometry();
}
void VToolShoulderPoint::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{
ContextMenu(dialogShoulderPoint, this, event);
}
void VToolShoulderPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
ContextMenu(dialogShoulderPoint, this, event);

View file

@ -118,6 +118,7 @@ public slots:
* @param factor
*/
virtual void SetFactor(qreal factor);
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected:
/**
* @brief contextMenuEvent

View file

@ -184,3 +184,8 @@ void VToolSinglePoint::SetFactor(qreal factor)
VDrawTool::SetFactor(factor);
RefreshPointGeometry(*(VAbstractTool::data.GeometricObject<const VPointF *>(id)));
}
void VToolSinglePoint::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{
ContextMenu(dialogSinglePoint, this, event, false);
}

View file

@ -77,6 +77,7 @@ public slots:
* @param factor
*/
virtual void SetFactor(qreal factor);
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
signals:
/**
* @brief FullUpdateTree

View file

@ -184,6 +184,11 @@ void VToolTriangle::FullUpdateFromGui(int result)
dialogTriangle.clear();
}
void VToolTriangle::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
{
ContextMenu(dialogTriangle, this, event);
}
void VToolTriangle::RemoveReferens()
{
doc->DecrementReferens(axisP1Id);

View file

@ -111,6 +111,7 @@ public slots:
* @param result
*/
virtual void FullUpdateFromGui(int result);
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected:
/**
* @brief RemoveReferens

View file

@ -73,3 +73,8 @@ void VGraphicsSimpleTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
Q_UNUSED(event);
this->setBrush(Qt::black);
}
void VGraphicsSimpleTextItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
emit ShowContextMenu(event);
}

View file

@ -60,6 +60,7 @@ signals:
* @param pos
*/
void NameChangePosition(const QPointF pos);
void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
protected:
/**
* @brief itemChange
@ -78,6 +79,7 @@ protected:
* @param event
*/
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
private:
/**
* @brief fontSize