Resolved issue #892. Show tooltip for piece node point.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-10-22 13:28:58 +03:00
parent 2989466c52
commit 1d95b36377
5 changed files with 28 additions and 3 deletions

View File

@ -1,3 +1,6 @@
# Version 0.7.0 (unreleased)
- [#892] Show tooltip for piece node point.
# Version 0.6.1 (unreleased)
- [#885] Regression. Broken support for multi size measurements.
- Fixed issues with seam allowance.

View File

@ -75,6 +75,7 @@ VNodePoint::VNodePoint(const VAbstractNodeInitData &initData, QObject *qoParent,
qoParent),
VScenePoint(parent)
{
m_namePoint->SetShowParentTooltip(false);
connect(m_namePoint, &VGraphicsSimpleTextItem::PointChoosed, this, &VNodePoint::PointChoosed);
connect(m_namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VNodePoint::NameChangePosition);
connect(m_namePoint, &VGraphicsSimpleTextItem::ShowContextMenu,
@ -84,6 +85,7 @@ VNodePoint::VNodePoint(const VAbstractNodeInitData &initData, QObject *qoParent,
});
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(initData.id));
ToolCreation(initData.typeCreation);
setCursor(Qt::ArrowCursor);
}
//---------------------------------------------------------------------------------------------------------------------
@ -422,6 +424,13 @@ void VNodePoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
}
}
//---------------------------------------------------------------------------------------------------------------------
void VNodePoint::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
setToolTip(VAbstractTool::data.GetGObject(m_id)->name());
VScenePoint::hoverEnterEvent(event);
}
//---------------------------------------------------------------------------------------------------------------------
void VNodePoint::EnableToolMove(bool move)
{

View File

@ -83,6 +83,7 @@ protected:
virtual void ShowNode() override;
virtual void HideNode() override;
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override;
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
private:
Q_DISABLE_COPY(VNodePoint)

View File

@ -59,7 +59,8 @@ VGraphicsSimpleTextItem::VGraphicsSimpleTextItem(QGraphicsItem * parent)
: QGraphicsSimpleTextItem(parent),
m_fontSize(0),
selectionType(SelectionType::ByMouseRelease),
m_oldScale(1)
m_oldScale(1),
m_showParentTooltip(true)
{
Init();
}
@ -74,7 +75,8 @@ VGraphicsSimpleTextItem::VGraphicsSimpleTextItem( const QString & text, QGraphic
: QGraphicsSimpleTextItem(text, parent),
m_fontSize(0),
selectionType(SelectionType::ByMouseRelease),
m_oldScale(1)
m_oldScale(1),
m_showParentTooltip(true)
{
Init();
}
@ -137,6 +139,12 @@ void VGraphicsSimpleTextItem::LabelSelectionType(const SelectionType &type)
selectionType = type;
}
//---------------------------------------------------------------------------------------------------------------------
void VGraphicsSimpleTextItem::SetShowParentTooltip(bool show)
{
m_showParentTooltip = show;
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief itemChange handle item change.
@ -219,7 +227,8 @@ void VGraphicsSimpleTextItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
this->setBrush(Qt::green);
if(QGraphicsItem *parent = parentItem())
QGraphicsItem *parent = parentItem();
if(parent && m_showParentTooltip)
{
setToolTip(parent->toolTip());
}

View File

@ -61,6 +61,8 @@ public:
void setEnabled(bool enabled);
void LabelSelectionType(const SelectionType &type);
void SetShowParentTooltip(bool show);
signals:
/**
* @brief NameChangePosition emit when label change position.
@ -88,6 +90,7 @@ private:
qint32 m_fontSize;
SelectionType selectionType;
qreal m_oldScale;
bool m_showParentTooltip;
void Init();
};