53 #include "../vmisc/def.h"
54 #include "../vmisc/vabstractapplication.h"
55 #include "../vgeometry/vpointf.h"
68 : QGraphicsEllipseItem(parent)
74 , m_showPointName(true)
81 setAcceptHoverEvents(
true);
82 setFlag(QGraphicsItem::ItemIsFocusable,
true);
86 void VScenePoint::paint(QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget)
93 if (
qApp->Settings()->getPointNameSize()*scale < 6 || !qApp->Settings()->getHidePointNames())
105 if (
qApp->Settings()->getUseToolColor())
108 leaderColor.setAlpha(128);
109 leaderPen.setColor(leaderColor);
114 leaderColor.setAlpha(128);
115 leaderPen.setColor(leaderColor);
123 QGraphicsEllipseItem::paint(painter, option, widget);
129 setFlag(QGraphicsItem::ItemSendsGeometryChanges,
false);
130 setPos(
static_cast<QPointF
>(point));
131 setFlag(QGraphicsItem::ItemSendsGeometryChanges,
true);
136 m_pointName->setFlag(QGraphicsItem::ItemSendsGeometryChanges,
false);
138 m_pointName->setFlag(QGraphicsItem::ItemSendsGeometryChanges,
true);
170 QGraphicsEllipseItem::hoverEnterEvent(event);
177 QGraphicsEllipseItem::hoverLeaveEvent(event);
184 nRect.translate(- scenePos());
185 if (not rect().intersects(nRect))
187 const QRectF nameRect =
m_pointName->sceneBoundingRect();
191 QLineF(QPointF(), nameRect.center() - scenePos()), p1, p2);
220 if (!
qApp->Settings()->isWireframe())
236 setPen(QPen(
correctColor(
this, QColor(
qApp->Settings()->getPointNameColor())), width));
238 if (!
qApp->Settings()->isWireframe())
240 setBrush(QBrush(
correctColor(
this, QColor(
qApp->Settings()->getPointNameColor())),Qt::SolidPattern));
244 setBrush(QBrush(
correctColor(
this, QColor(
qApp->Settings()->getPointNameColor())),Qt::NoBrush));
static qint32 LineIntersectCircle(const QPointF ¢er, qreal radius, const QLineF &line, QPointF &p1, QPointF &p2)
LineIntersectCircle find point intersection line and circle.
virtual QString name() const
name return name graphical object.
static QPointF LineIntersectRect(const QRectF &rec, const QLineF &line)
LineIntersectRect find point intersection line and rect.
The VGraphicsSimpleTextItem class pointer label.
void setTextColor(const QColor &color)
void setPosition(QPointF pos)
The VPointF class keep data of point.
qreal mx() const
mx return offset name respect to x
bool isShowPointName() const
qreal my() const
my return offset name respect to y
void setBasicWidth(const qreal &value)
VGraphicsSimpleTextItem * m_pointName
bool m_onlyPoint
m_pointColor color of point.
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE
VScenePoint(const QColor &lineColor, QGraphicsItem *parent=nullptr)
QColor m_pointColor
pointL line that we see if Text is moved too away from point.
void setPointColor(const QString &value)
VScaledLine * m_pointLeader
namePoint point text.
void setOnlyPoint(bool value)
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE
void setPointPen(qreal scale)
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr) Q_DECL_OVERRIDE
virtual void refreshPointGeometry(const VPointF &point)
double ToPixel(double val, const Unit &unit)
const qreal widthMainLine
qreal sceneScale(QGraphicsScene *scene)
void scaleCircleSize(QGraphicsEllipseItem *item, qreal scale)
qreal scaledRadius(qreal scale)
qreal scaleWidth(qreal width, qreal scale)
QColor correctColor(const QGraphicsItem *item, const QColor &color)
const qreal widthHairLine