diff --git a/ChangeLog.txt b/ChangeLog.txt index 1e29228f2..324834f38 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -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. diff --git a/src/libs/vtools/tools/nodeDetails/vnodepoint.cpp b/src/libs/vtools/tools/nodeDetails/vnodepoint.cpp index 5a816930e..f60b9fa97 100644 --- a/src/libs/vtools/tools/nodeDetails/vnodepoint.cpp +++ b/src/libs/vtools/tools/nodeDetails/vnodepoint.cpp @@ -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(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) { diff --git a/src/libs/vtools/tools/nodeDetails/vnodepoint.h b/src/libs/vtools/tools/nodeDetails/vnodepoint.h index a46669928..2b23680ab 100644 --- a/src/libs/vtools/tools/nodeDetails/vnodepoint.h +++ b/src/libs/vtools/tools/nodeDetails/vnodepoint.h @@ -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) diff --git a/src/libs/vwidgets/vgraphicssimpletextitem.cpp b/src/libs/vwidgets/vgraphicssimpletextitem.cpp index 47b8d15ab..8ce8c76a1 100644 --- a/src/libs/vwidgets/vgraphicssimpletextitem.cpp +++ b/src/libs/vwidgets/vgraphicssimpletextitem.cpp @@ -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()); } diff --git a/src/libs/vwidgets/vgraphicssimpletextitem.h b/src/libs/vwidgets/vgraphicssimpletextitem.h index f6d6b5be0..b2ab41689 100644 --- a/src/libs/vwidgets/vgraphicssimpletextitem.h +++ b/src/libs/vwidgets/vgraphicssimpletextitem.h @@ -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(); };