18 #ifndef QETSHAPEITEM_H 19 #define QETSHAPEITEM_H 63 enum {
Type = UserType + 1008 };
78 virtual bool fromXml (
const QDomElement &);
79 virtual QDomElement
toXml (QDomDocument &document)
const;
80 virtual bool toDXF (
const QString &filepath,
const QPen &
pen);
83 QString
name()
const override;
85 void setP2 (
const QPointF &P2);
105 QPainterPath
shape()
const override;
108 void paint(QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget)
override;
112 QVariant
itemChange(GraphicsItemChange change,
const QVariant &value)
override;
151 #endif // QETSHAPEITEM_H
bool sceneEventFilter(QGraphicsItem *watched, QEvent *event) override
QetShapeItem::sceneEventFilter.
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override
QetShapeItem::contextMenuEvent.
bool setPolygon(const QPolygonF &polygon)
QetShapeItem::setPolygon Set this item geometry to polygon (only available if shape is a polyline) ...
QVector< QetGraphicsHandlerItem * > m_handler_vector
QRectF boundingRect() const override
QetShapeItem::boundingRect.
virtual bool fromXml(const QDomElement &)
QetShapeItem::fromXml Build this item from the xml description.
void removePoints(int number=1)
QetShapeItem::removePoints Number of point to remove on the polygon If is superior to number of poly...
QVariant itemChange(GraphicsItemChange change, const QVariant &value) override
QetShapeItem::itemChange.
The QetGraphicsHandlerItem class This graphics item represents a point, destined to be used as an han...
QPolygonF polygon() const
void handlerMousePressEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
QetShapeItem::handlerMousePressEvent.
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override
QetShapeItem::hoverLeaveEvent Handle hover leave event.
void adjusteHandlerPos()
QetShapeItem::adjusteHandlerPos Adjust the position of the handler item.
QetShapeItem(QPointF, QPointF=QPointF(0, 0), ShapeType=Line, QGraphicsItem *parent=nullptr)
QetShapeItem::QetShapeItem Constructor of shape item. point 1 and 2 must be in scene coordinate...
void handlerMouseMoveEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
QetShapeItem::handlerMouseMoveEvent.
void setP2(const QPointF &P2)
QetShapeItem::setP2 Set the second point of this item. If this item is a polyline, the last point of the polyline is replaced by P2.
QPainterPath shape() const override
QetShapeItem::shape.
int type() const override
void mousePressEvent(QGraphicsSceneMouseEvent *event) override
virtual QDomElement toXml(QDomDocument &document) const
QetShapeItem::toXml Save this item to xml element.
int pointsCount() const
QetShapeItem::pointCount.
ShapeType m_shapeType
ATTRIBUTES.
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
QetShapeItem::paint Paint this item.
void editProperty() override
QetShapeItem::editProperty Edit the property of this item.
void setClosed(bool close)
QetShapeItem::setClosed Close this item, have effect only if this item is a polygon.
bool setRect(const QRectF &rect)
QetShapeItem::setRect Set this item geometry to rect (only available if shape is a rectangle or an el...
bool m_modifie_radius_equaly
The QetShapeItem class this class is used to draw a basic shape (line, rectangle, ellipse) into a dia...
void setPen(const QPen &pen)
QetShapeItem::setPen Set the pen to use for draw the shape.
void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override
QetShapeItem::hoverEnterEvent Handle hover enter event.
void handlerMouseReleaseEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
QetShapeItem::handlerMouseReleaseEvent.
QPointF m_context_menu_pos
bool setLine(const QLineF &line)
QetShapeItem::setLine Set item geometry to line (only available for line shape)
ShapeType shapeType() const
void setBrush(const QBrush &brush)
QetShapeItem::setBrush Set the brush to use for the fill the shape.
QString name() const override
QetShapeItem::name.
void setNextPoint(QPointF P)
QetShapeItem::setNextPoint Add a new point to the curent polygon.
virtual bool toDXF(const QString &filepath, const QPen &pen)
QetShapeItem::toDXF Draw this element to the dxf document.
void switchResizeMode()
QetShapeItem::switchResizeMode.