56 #include <QGraphicsScene>
57 #include <QGraphicsSceneMouseEvent>
59 #include <QMessageLogger>
60 #include <QPainterPath>
66 #include "../vgeometry/vabstractcurve.h"
67 #include "../vmisc/vabstractapplication.h"
68 #include "../ifc/xml/vabstractpattern.h"
79 this->setBrush(QBrush(Qt::NoBrush));
80 this->setAcceptHoverEvents(
true);
81 this->setFlag(QGraphicsItem::ItemIsFocusable,
true);
97 qWarning() << tr(
"VSimpleCurve::RefreshGeometry: pointer to curve is null.");
117 QGraphicsPathItem::mousePressEvent(event);
120 if (not (flags() & ItemIsSelectable) && scene())
122 scene()->clearSelection();
131 if (event->button() == Qt::LeftButton)
143 if (event->button() == Qt::LeftButton)
148 QGraphicsPathItem::mouseReleaseEvent(event);
159 QGraphicsPathItem::hoverEnterEvent(event);
167 QGraphicsPathItem::hoverLeaveEvent(event);
173 if (change == QGraphicsItem::ItemSelectedChange)
178 return QGraphicsPathItem::itemChange(change, value);
190 switch (event->key())
198 QGraphicsPathItem::keyReleaseEvent ( event );
void showContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=null_id)
SelectionType selectionType
void SetPoints(const QVector< QPointF > &points)
void SetDirectionArrows(const QVector< QPair< QLineF, QLineF >> &arrows)
void CurveSelected(bool selected)
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE
void RefreshGeometry(const QSharedPointer< VAbstractCurve > &curve)
virtual void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) Q_DECL_OVERRIDE
void Selected(bool selected, quint32 id)
VSimpleCurve(quint32 id, const QSharedPointer< VAbstractCurve > &curve, QObject *parent=nullptr)
virtual void ScalePenWidth() Q_DECL_OVERRIDE
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE
void Choosed(quint32 id)
Choosed send id when clicked.
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE
QSharedPointer< VAbstractCurve > m_curve
double ToPixel(double val, const Unit &unit)
const qreal widthMainLine
qreal sceneScale(QGraphicsScene *scene)
qreal scaleWidth(qreal width, qreal scale)
QColor correctColor(const QGraphicsItem *item, const QColor &color)
Qt::PenStyle lineTypeToPenStyle(const QString &lineType)
LineStyle return pen style for current line style.