|
QElectroTech
0.8-dev
|
Go to the documentation of this file.
18 #ifndef QETSHAPEITEM_H
19 #define QETSHAPEITEM_H
63 enum {
Type = UserType + 1008 };
79 virtual bool fromXml (
const QDomElement &);
80 virtual QDomElement
toXml (QDomDocument &document)
const;
81 virtual bool toDXF (
const QString &filepath,
const QPen &
pen);
84 QString
name()
const override;
86 void setP2 (
const QPointF &P2);
106 QPainterPath
shape()
const override;
109 void paint(QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget)
override;
113 QVariant
itemChange(GraphicsItemChange change,
const QVariant &value)
override;
152 #endif // QETSHAPEITEM_H
void removePoints(int number=1)
QetShapeItem::removePoints Number of point to remove on the polygon If number is superior to number o...
Definition: qetshapeitem.cpp:228
void editProperty() override
QetShapeItem::editProperty Edit the property of this item.
Definition: qetshapeitem.cpp:1004
@ Rectangle
Definition: qetshapeitem.h:58
void setBrush(const QBrush &brush)
QetShapeItem::setBrush Set the brush to use for the fill the shape.
Definition: qetshapeitem.cpp:89
@ Type
Definition: qetgraphicshandleritem.h:42
void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override
QetShapeItem::hoverEnterEvent Handle hover enter event.
Definition: qetshapeitem.cpp:341
int m_vector_index
Definition: qetshapeitem.h:140
ShapeType shapeType() const
Definition: qetshapeitem.h:77
int m_resize_mode
Definition: qetshapeitem.h:143
ShapeType m_shapeType
ATTRIBUTES.
Definition: qetshapeitem.h:130
Definition: qetgraphicsitem.h:27
void addHandler()
Definition: qetshapeitem.cpp:561
bool sceneEventFilter(QGraphicsItem *watched, QEvent *event) override
QetShapeItem::sceneEventFilter.
Definition: qetshapeitem.cpp:414
qreal m_xRadius
Definition: qetshapeitem.h:147
void setYRadius(qreal Y)
Definition: qetshapeitem.cpp:194
Diagram * diagram() const
Definition: qetgraphicsitem.cpp:40
QVector< QetGraphicsHandlerItem * > m_handler_vector
Definition: qetshapeitem.h:144
QBrush brushFromXml(const QDomElement &element)
QETXML::brushFromXml Build a QBrush from a xml description.
Definition: qetxml.cpp:135
static QVector< QPointF > pointForRadiusRect(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode=Qt::AbsoluteSize)
QetGraphicsHandlerUtility::pointForRadiusRect.
Definition: qetgraphicshandlerutility.cpp:276
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override
QetShapeItem::hoverLeaveEvent Handle hover leave event.
Definition: qetshapeitem.cpp:352
bool close
Definition: qetshapeitem.h:44
virtual bool fromXml(const QDomElement &)
QetShapeItem::fromXml Build this item from the xml description.
Definition: qetshapeitem.cpp:849
@ Type
Definition: qetshapeitem.h:63
void setNextPoint(QPointF P)
QetShapeItem::setNextPoint Add a new point to the curent polygon.
Definition: qetshapeitem.cpp:215
bool m_closed
Definition: qetshapeitem.h:141
QPainterPath shape() const override
QetShapeItem::shape.
Definition: qetshapeitem.cpp:257
bool isClosed() const
Definition: qetshapeitem.h:93
QDomElement brushToXml(QDomDocument &parent_document, const QBrush &brush)
QETXML::brushToXml Write attribute of a QBrush in xml element.
Definition: qetxml.cpp:97
static qreal radiusForPosAtIndex(const QRectF &rect, const QPointF &pos, int index, Qt::SizeMode mode=Qt::AbsoluteSize)
QetGraphicsHandlerUtility::radiusForPosAtIndex.
Definition: qetgraphicshandlerutility.cpp:316
ShapeType
Definition: qetshapeitem.h:57
QPointF m_P1
Definition: qetshapeitem.h:133
QDomElement penToXml(QDomDocument &parent_document, const QPen &pen)
QETXML::penToXml Write attribute of a QPen in xml element.
Definition: qetxml.cpp:33
qreal yRadius
Definition: qetshapeitem.h:46
void setPen(const QPen &pen)
QetShapeItem::setPen Set the pen to use for draw the shape.
Definition: qetshapeitem.cpp:76
QList< QDomElement > findInDomElement(const QDomElement &, const QString &)
Definition: qet.cpp:333
qreal m_old_xRadius
Definition: qetshapeitem.h:149
QRectF boundingRect() const override
QetShapeItem::boundingRect.
Definition: qetshapeitem.cpp:249
virtual QDomElement toXml(QDomDocument &document) const
QetShapeItem::toXml Save this item to xml element.
Definition: qetshapeitem.cpp:906
QPolygonF polygon
Definition: qetshapeitem.h:43
QBrush brush
Definition: qetshapeitem.h:40
QPolygonF polygon() const
Definition: qetshapeitem.h:91
virtual bool toDXF(const QString &filepath, const QPen &pen)
QetShapeItem::toDXF Draw this element to the dxf document.
Definition: qetshapeitem.cpp:967
~QetShapeItem() override
Definition: qetshapeitem.cpp:65
QAction * m_remove_point
Definition: qetshapeitem.h:146
static QRectF mirrorRectForPosAtIndex(const QRectF &old_rect, const QPointF &pos, int index)
QetGraphicsHandlerUtility::mirrorRectForPosAtIndex Return a rectangle after modification of the point...
Definition: qetgraphicshandlerutility.cpp:139
@ Ellipse
Definition: qetshapeitem.h:59
void mousePressEvent(QGraphicsSceneMouseEvent *event) override
Definition: qetshapeitem.cpp:358
QPen pen() const
METHODS.
Definition: qetshapeitem.h:73
QBrush m_brush
Definition: qetshapeitem.h:132
bool setRect(const QRectF &rect)
QetShapeItem::setRect Set this item geometry to rect (only available if shape is a rectangle or an el...
Definition: qetshapeitem.cpp:140
QString name() const override
QetShapeItem::name.
Definition: qetshapeitem.cpp:1016
bool m_modifie_radius_equaly
Definition: qetshapeitem.h:142
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
QetShapeItem::paint Paint this item.
Definition: qetshapeitem.cpp:298
static QVector< QPointF > pointsForRect(const QRectF &rect)
QetGraphicsHandlerUtility::pointsForRect Return the keys points of the rectangle, stored in a vector....
Definition: qetgraphicshandlerutility.cpp:36
QRectF rect() const
Definition: qetshapeitem.h:89
QPointF m_context_menu_pos
Definition: qetshapeitem.h:137
static int getcolorCode(const long red, const long green, const long blue)
Createdxf::getcolorCode This function returns the ACI color which is the "nearest" color to the color...
Definition: createdxf.cpp:389
qreal XRadius() const
Definition: qetshapeitem.h:95
static void drawLine(const QString &filapath, double, double, double, double, const int &clorcode)
Definition: createdxf.cpp:290
void adjusteHandlerPos()
QetShapeItem::adjusteHandlerPos Adjust the position of the handler item.
Definition: qetshapeitem.cpp:606
bool is_movable_
Definition: qetgraphicsitem.h:56
QIcon de
Definition: qeticons.cpp:188
@ Polygon
Definition: qetshapeitem.h:60
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override
QetShapeItem::contextMenuEvent.
Definition: qetshapeitem.cpp:452
QLineF line() const
Definition: qetshapeitem.h:87
void setP2(const QPointF &P2)
QetShapeItem::setP2 Set the second point of this item. If this item is a polyline,...
Definition: qetshapeitem.cpp:104
qreal YRadius() const
Definition: qetshapeitem.h:97
static QRectF rectForPosAtIndex(const QRectF &old_rect, const QPointF &pos, int index)
QetGraphicsHandlerUtility::rectForPosAtIndex Return a rectangle after modification of the point 'pos'...
Definition: qetgraphicshandlerutility.cpp:106
QPointF m_old_P1
Definition: qetshapeitem.h:135
QUndoStack & undoStack()
Diagram::undoStack.
Definition: diagram.h:397
QRectF rect
Definition: qetshapeitem.h:41
void mousePressEvent(QGraphicsSceneMouseEvent *event) override
Definition: qetgraphicsitem.cpp:79
The QetGraphicsHandlerItem class This graphics item represents a point, destined to be used as an han...
Definition: qetgraphicshandleritem.h:37
static void drawRectangle(const QString &filepath, double, double, double, double, const int &colorcode)
Definition: createdxf.cpp:565
void setAnimated(bool animate=true, bool first_time=true)
QPropertyUndoCommand::setAnimated.
Definition: qpropertyundocommand.cpp:103
QPen m_pen
Definition: qetshapeitem.h:131
QBrush brush() const
Definition: qetshapeitem.h:75
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.
Definition: qetshapeitem.cpp:38
QPolygonF m_polygon
Definition: qetshapeitem.h:138
qreal m_yRadius
Definition: qetshapeitem.h:148
QPen penFromXml(const QDomElement &element)
QETXML::penFromXml Build a QPen from a xml description.
Definition: qetxml.cpp:62
void removePoint()
Definition: qetshapeitem.cpp:668
bool setPolygon(const QPolygonF &polygon)
QetShapeItem::setPolygon Set this item geometry to polygon (only available if shape is a polyline)
Definition: qetshapeitem.cpp:160
QPolygonF m_old_polygon
Definition: qetshapeitem.h:138
static void drawEllipse(const QString &filepath, const QRectF &rect, const int &colorcode)
Createdxf::drawEllipse Conveniance function for draw ellipse.
Definition: createdxf.cpp:556
void switchResizeMode()
QetShapeItem::switchResizeMode.
Definition: qetshapeitem.cpp:510
QAction * m_insert_point
Definition: qetshapeitem.h:145
bool m_hovered
Definition: qetshapeitem.h:139
QPointF m_P2
Definition: qetshapeitem.h:134
bool setLine(const QLineF &line)
QetShapeItem::setLine Set item geometry to line (only available for line shape)
Definition: qetshapeitem.cpp:124
int pointsCount() const
QetShapeItem::pointCount.
Definition: qetshapeitem.cpp:206
void handlerMousePressEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
QetShapeItem::handlerMousePressEvent.
Definition: qetshapeitem.cpp:706
void insertPoint()
Definition: qetshapeitem.cpp:652
@ Line
Definition: qetshapeitem.h:57
qreal xRadius
Definition: qetshapeitem.h:45
The PropertiesEditorDialog class Create a dialog to edit some properties of a thing....
Definition: propertieseditordialog.h:42
static QPointF snapToGrid(const QPointF &p)
Diagram::snapToGrid Return a nearest snap point of p.
Definition: diagram.cpp:2240
The QetShapeItem class this class is used to draw a basic shape (line, rectangle, ellipse) into a dia...
Definition: qetshapeitem.h:36
void handlerMouseMoveEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
QetShapeItem::handlerMouseMoveEvent.
Definition: qetshapeitem.cpp:726
qreal m_old_yRadius
Definition: qetshapeitem.h:150
QPointF m_old_P2
Definition: qetshapeitem.h:136
Definition: diagramview.h:38
QVariant itemChange(GraphicsItemChange change, const QVariant &value) override
QetShapeItem::itemChange.
Definition: qetshapeitem.cpp:375
static QPolygonF polygonForInsertPoint(const QPolygonF &old_polygon, bool closed, const QPointF &pos)
QetGraphicsHandlerUtility::polygonForInsertPoint.
Definition: qetgraphicshandlerutility.cpp:213
int type() const override
Definition: qetshapeitem.h:70
The QPropertyUndoCommand class This undo command manage QProperty of a QObject. This undo command can...
Definition: qpropertyundocommand.h:34
void setClosed(bool close)
QetShapeItem::setClosed Close this item, have effect only if this item is a polygon.
Definition: qetshapeitem.cpp:176
QPen pen
Definition: qetshapeitem.h:39
static QVector< QetGraphicsHandlerItem * > handlerForPoint(const QVector< QPointF > &points, int size=10)
QetGraphicsHandlerItem::handlerForPoint.
Definition: qetgraphicshandleritem.cpp:87
QIcon Add
Definition: qeticons.cpp:24
QLineF line
Definition: qetshapeitem.h:42
void handlerMouseReleaseEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
QetShapeItem::handlerMouseReleaseEvent.
Definition: qetshapeitem.cpp:790
QIcon tr
Definition: qeticons.cpp:206
QList< QAction * > contextMenuActions() const
DiagramView::contextMenuActions.
Definition: diagramview.cpp:1152
void setXRadius(qreal X)
Definition: qetshapeitem.cpp:186
QIcon Remove
Definition: qeticons.cpp:155