From 2a3d52ba880608470a79efefdc08823716d93f95 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 21 Oct 2017 16:26:22 +0300 Subject: [PATCH] Improve scene point. Scale line to label and make the line more transparent. --HG-- branch : feature --- src/libs/vwidgets/vscenepoint.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libs/vwidgets/vscenepoint.cpp b/src/libs/vwidgets/vscenepoint.cpp index e51ccb5c9..ffb381f23 100644 --- a/src/libs/vwidgets/vscenepoint.cpp +++ b/src/libs/vwidgets/vscenepoint.cpp @@ -78,7 +78,9 @@ void VScenePoint::paint(QPainter *painter, const QStyleOptionGraphicsItem *optio m_namePoint->setVisible(m_showLabel); QPen lPen = m_lineName->pen(); - lPen.setColor(CorrectColor(m_lineName, Qt::black)); + QColor color = CorrectColor(m_lineName, Qt::black); + color.setAlpha(50); + lPen.setColor(color); m_lineName->setPen(lPen); RefreshLine(); @@ -148,7 +150,7 @@ void VScenePoint::RefreshLine() QLineF(QPointF(), nameRec.center() - scenePos()), p1, p2); const QPointF pRec = VGObject::LineIntersectRect(nameRec, QLineF(scenePos(), nameRec.center())); - if (QLineF(p1, pRec - scenePos()).length() <= ToPixel(4, Unit::Mm)) + if (QLineF(p1, pRec - scenePos()).length() <= ToPixel(4/qMax(1.0, SceneScale(scene())), Unit::Mm)) { m_lineName->setVisible(false); }