| 1 | /* |
| 2 | Copyright 2006-2023 The QElectroTech Team |
| 3 | This file is part of QElectroTech. |
| 4 | |
| 5 | QElectroTech is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by |
| 7 | the Free Software Foundation, either version 2 of the License, or |
| 8 | (at your option) any later version. |
| 9 | |
| 10 | QElectroTech is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License |
| 16 | along with QElectroTech. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | #ifndef QETSHAPEITEM_H |
| 19 | #define QETSHAPEITEM_Hcxx . . $ `sources/qetgraphicsitem/qetshapeitem.h:19:9`! |
| 20 | |
| 21 | #include "../QetGraphicsItemModeler/qetgraphicshandleritem.h"cxx . . $ `<file>/sources/QetGraphicsItemModeler/qetgraphicshandleritem.h`/ |
| 22 | #include "qetgraphicsitem.h"cxx . . $ `<file>/sources/qetgraphicsitem/qetgraphicsitem.h`/ |
| 23 | |
| 24 | #include <QPen> |
| 25 | |
| 26 | class QDomElementcxx . . $ QDomElement#; |
| 27 | class QDomDocumentcxx . . $ QDomDocument#; |
| 28 | class QetGraphicsHandlerItemcxx . . $ QetGraphicsHandlerItem#; |
| 29 | class QActioncxx . . $ QAction#; |
| 30 | |
| 31 | /** |
| 32 | @brief The QetShapeItem class |
| 33 | this class is used to draw a basic shape (line, rectangle, ellipse) |
| 34 | into a diagram, that can be saved to .qet file. |
| 35 | */ |
| 36 | class QetShapeItemcxx . . $ QetShapeItem# : public QetGraphicsItemcxx . . $ QetGraphicsItem# |
| 37 | { |
| 38 | Q_OBJECTcxx . . $ QetShapeItem#QPrivateSignal# |
| 39 | |
| 40 | Q_PROPERTYcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:104:9`!(QPen pen READ pen WRITE setPen NOTIFY penChanged) |
| 41 | Q_PROPERTYcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:104:9`!(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged) |
| 42 | Q_PROPERTYcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:104:9`!(QRectF rect READ rect WRITE setRect) |
| 43 | Q_PROPERTYcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:104:9`!(QLineF line READ line WRITE setLine) |
| 44 | Q_PROPERTYcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:104:9`!(QPolygonF polygon READ polygon WRITE setPolygon) |
| 45 | Q_PROPERTYcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:104:9`!(bool close READ isClosed WRITE setClosed NOTIFY closeChanged) |
| 46 | Q_PROPERTYcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:104:9`!(qreal xRadius READ XRadius WRITE setXRadius NOTIFY XRadiusChanged) |
| 47 | Q_PROPERTYcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:104:9`!(qreal yRadius READ YRadius WRITE setYRadius NOTIFY YRadiusChanged) |
| 48 | |
| 49 | signalscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:89:14`!: |
| 50 | void penChangedcxx . . $ QetShapeItem#penChanged(49f6e7a06ebc5aa8).(); |
| 51 | void brushChangedcxx . . $ QetShapeItem#brushChanged(49f6e7a06ebc5aa8).(); |
| 52 | void closeChangedcxx . . $ QetShapeItem#closeChanged(49f6e7a06ebc5aa8).(); |
| 53 | void XRadiusChangedcxx . . $ QetShapeItem#XRadiusChanged(49f6e7a06ebc5aa8).(); |
| 54 | void YRadiusChangedcxx . . $ QetShapeItem#YRadiusChanged(49f6e7a06ebc5aa8).(); |
| 55 | |
| 56 | |
| 57 | public: |
| 58 | enum ShapeTypecxx . . $ QetShapeItem#ShapeType# {Linecxx . . $ QetShapeItem#Line. =1, |
| 59 | Rectanglecxx . . $ QetShapeItem#Rectangle. =2, |
| 60 | Ellipsecxx . . $ QetShapeItem#Ellipse. =4, |
| 61 | Polygoncxx . . $ QetShapeItem#Polygon. =8 }; |
| 62 | Q_ENUMcxx . . $ QetShapeItem#ShapeType# (ShapeType) |
| 63 | |
| 64 | enumcxx . . $ QetShapeItem#$anonymous_type_0# { Typecxx . . $ QetShapeItem#Type. = UserTypecxx . . $ QGraphicsItem#UserType. + 1008 }; |
| 65 | |
| 66 | QetShapeItemcxx . . $ QetShapeItem#QetShapeItem(ffead1312e28c8fb).( |
| 67 | QPointFcxx . . $ QPointF#, |
| 68 | QPointFcxx . . $ QPointF# = QPointFcxx . . $ QPointF#QPointF(bc12c9ec15586e6a).(0,0), |
| 69 | ShapeTypecxx . . $ QetShapeItem#ShapeType# = Linecxx . . $ QetShapeItem#Line., |
| 70 | QGraphicsItemcxx . . $ QGraphicsItem# *parent = nullptr); |
| 71 | ~cxx . . $ QetShapeItem#`~QetShapeItem`(ced63f7c635d850d).QetShapeItemcxx . . $ QetShapeItem#() override; |
| 72 | |
| 73 | //Enable the use of qgraphicsitem_cast to safely cast a |
| 74 | //QGraphicsItem into a QetShapeItem return the QGraphicsItem type |
| 75 | int typecxx . . $ QetShapeItem#type(455f465bc33b4cdf).() const override { return Typecxx . . $ QetShapeItem#Type.; } |
| 76 | |
| 77 | ///METHODS |
| 78 | QPencxx . . $ QPen# pencxx . . $ QetShapeItem#pen(30fcf0e42d084f28).() const {return m_pencxx . . $ QetShapeItem#m_pen.;} |
| 79 | void setPencxx . . $ QetShapeItem#setPen(af0a25dfda3214db).(const QPencxx . . $ QPen# &pen); |
| 80 | QBrushcxx . . $ QBrush# brushcxx . . $ QetShapeItem#brush(583354ac483a5b23).() const {return m_brushcxx . . $ QBrush#QBrush(ffc9f5d0bda78261).;} |
| 81 | void setBrushcxx . . $ QetShapeItem#setBrush(ffc9f5d0bda78261).(const QBrushcxx . . $ QBrush# &brush); |
| 82 | ShapeTypecxx . . $ QetShapeItem#ShapeType# shapeTypecxx . . $ QetShapeItem#shapeType(4253ff49eea28ff1).() const {return m_shapeTypecxx . . $ QetShapeItem#m_shapeType.;} |
| 83 | |
| 84 | virtual bool fromXmlcxx . . $ QetShapeItem#fromXml(5f8d2f7f90f83411). (const QDomElementcxx . . $ QDomElement# &); |
| 85 | virtual QDomElementcxx . . $ QDomElement# toXmlcxx . . $ QetShapeItem#toXml(f12f6d4cd5f05c29). (QDomDocumentcxx . . $ QDomDocument# &document) const; |
| 86 | virtual bool toDXFcxx . . $ QetShapeItem#toDXF(6518879130ba262f). (const QStringcxx . . $ QString# &filepath,const QPencxx . . $ QPen# &pen); |
| 87 | |
| 88 | void editPropertycxx . . $ QetShapeItem#editProperty(49f6e7a06ebc5aa8).() override; |
| 89 | QStringcxx . . $ QString# namecxx . . $ QetShapeItem#name(6ef7b6c27b00b43d).() const override; |
| 90 | |
| 91 | void setP2cxx . . $ QetShapeItem#setP2(4258778b894f8bb6). (const QPointFcxx . . $ QPointF# &P2); |
| 92 | QLineFcxx . . $ QLineF# linecxx . . $ QetShapeItem#line(7b154b2d037b6f47).() const{return QLineFcxx . . $ QLineF#QLineF(3628e2b324c1bb0).(m_P1cxx . . $ QetShapeItem#m_P1., m_P2cxx . . $ QetShapeItem#m_P2.);} |
| 93 | bool setLinecxx . . $ QetShapeItem#setLine(5a86af96757a64ac). (const QLineFcxx . . $ QLineF# &line); |
| 94 | QRectFcxx . . $ QRectF# rectcxx . . $ QetShapeItem#rect(19f9350443f914b1).() const{return QRectFcxx . . $ QRectF#QRectF(26f44d9079f833ac).(m_P1cxx . . $ QetShapeItem#m_P1., m_P2cxx . . $ QetShapeItem#m_P2.);} |
| 95 | bool setRectcxx . . $ QetShapeItem#setRect(d8e88e9957cf441f). (const QRectFcxx . . $ QRectF# &rect); |
| 96 | QPolygonFcxx . . $ QPolygonF# polygoncxx . . $ QetShapeItem#polygon(c51a08a1493ec5ce).() const {return m_polygoncxx . . $ QetShapeItem#m_polygon.;} |
| 97 | bool setPolygoncxx . . $ QetShapeItem#setPolygon(fe04f39e61b7e239). (const QPolygonFcxx . . $ QPolygonF# &polygon); |
| 98 | bool isClosedcxx . . $ QetShapeItem#isClosed(50ce9a9e25b4a850).() const {return m_closedcxx . . $ QetShapeItem#m_closed.;} |
| 99 | void setClosedcxx . . $ QetShapeItem#setClosed(b45ddcbc8423892c). (bool close); |
| 100 | qrealcxx . . $ qreal# XRadiuscxx . . $ QetShapeItem#XRadius(21b6c25e127938e2).() const {return m_xRadiuscxx . . $ QetShapeItem#m_xRadius.;} |
| 101 | void setXRadiuscxx . . $ QetShapeItem#setXRadius(ba8836b59fb42830).(qrealcxx . . $ qreal# X); |
| 102 | qrealcxx . . $ qreal# YRadiuscxx . . $ QetShapeItem#YRadius(21b6c25e127938e2).() const {return m_yRadiuscxx . . $ QetShapeItem#m_yRadius.;} |
| 103 | void setYRadiuscxx . . $ QetShapeItem#setYRadius(ba8836b59fb42830).(qrealcxx . . $ qreal# Y); |
| 104 | |
| 105 | //Methods available for polygon shape |
| 106 | int pointsCountcxx . . $ QetShapeItem#pointsCount(455f465bc33b4cdf). () const; |
| 107 | void setNextPointcxx . . $ QetShapeItem#setNextPoint(f314d96e01811e97). (QPointFcxx . . $ QPointF# P); |
| 108 | void removePointscxx . . $ QetShapeItem#removePoints(d4f767463ce0a6b3). (int number = 1); |
| 109 | |
| 110 | QRectFcxx . . $ QRectF# boundingRectcxx . . $ QetShapeItem#boundingRect(19f9350443f914b1).() const override; |
| 111 | QPainterPathcxx . . $ QPainterPath# shapecxx . . $ QetShapeItem#shape(d1b3728536d604d3).() const override; |
| 112 | |
| 113 | protected: |
| 114 | void paintcxx . . $ QetShapeItem#paint(75fb761ce905ae5).( |
| 115 | QPaintercxx . . $ QPainter# *painter, |
| 116 | const QStyleOptionGraphicsItemcxx . . $ QStyleOptionGraphicsItem# *option, |
| 117 | QWidgetcxx . . $ QWidget# *widget) override; |
| 118 | void hoverEnterEventcxx . . $ QetShapeItem#hoverEnterEvent(763e94a485b44b92). (QGraphicsSceneHoverEventcxx . . $ QGraphicsSceneHoverEvent# *event) override; |
| 119 | void hoverLeaveEventcxx . . $ QetShapeItem#hoverLeaveEvent(763e94a485b44b92). (QGraphicsSceneHoverEventcxx . . $ QGraphicsSceneHoverEvent# *event) override; |
| 120 | void mousePressEventcxx . . $ QetShapeItem#mousePressEvent(11b24ffc11328e2d). (QGraphicsSceneMouseEventcxx . . $ QGraphicsSceneMouseEvent# *event) override; |
| 121 | QVariantcxx . . $ QVariant# itemChangecxx . . $ QetShapeItem#itemChange(a9835c8a959d837).( |
| 122 | GraphicsItemChangecxx . . $ QGraphicsItem#GraphicsItemChange# change, |
| 123 | const QVariantcxx . . $ QVariant# &value) override; |
| 124 | bool sceneEventFiltercxx . . $ QetShapeItem#sceneEventFilter(78864a0f1cef6b3f).( |
| 125 | QGraphicsItemcxx . . $ QGraphicsItem# *watched, |
| 126 | QEventcxx . . $ QEvent# *event) override; |
| 127 | void contextMenuEventcxx . . $ QetShapeItem#contextMenuEvent(793128481b3a6a66).( |
| 128 | QGraphicsSceneContextMenuEventcxx . . $ QGraphicsSceneContextMenuEvent# *event) override; |
| 129 | |
| 130 | private: |
| 131 | void switchResizeModecxx . . $ QetShapeItem#switchResizeMode(49f6e7a06ebc5aa8).(); |
| 132 | void addHandlercxx . . $ QetShapeItem#addHandler(49f6e7a06ebc5aa8).(); |
| 133 | void adjusteHandlerPoscxx . . $ QetShapeItem#adjusteHandlerPos(49f6e7a06ebc5aa8).(); |
| 134 | void insertPointcxx . . $ QetShapeItem#insertPoint(49f6e7a06ebc5aa8).(); |
| 135 | void removePointcxx . . $ QetShapeItem#removePoint(49f6e7a06ebc5aa8).(); |
| 136 | |
| 137 | void handlerMousePressEventcxx . . $ QetShapeItem#handlerMousePressEvent(49f6e7a06ebc5aa8).(); |
| 138 | void handlerMouseMoveEventcxx . . $ QetShapeItem#handlerMouseMoveEvent(11b24ffc11328e2d).(QGraphicsSceneMouseEventcxx . . $ QGraphicsSceneMouseEvent# *event); |
| 139 | void handlerMouseReleaseEventcxx . . $ QetShapeItem#handlerMouseReleaseEvent(49f6e7a06ebc5aa8).(); |
| 140 | |
| 141 | ///ATTRIBUTES |
| 142 | private: |
| 143 | ShapeTypecxx . . $ QetShapeItem#ShapeType# m_shapeTypecxx . . $ QetShapeItem#m_shapeType.; |
| 144 | QPencxx . . $ QPen# m_pencxx . . $ QetShapeItem#m_pen.; |
| 145 | QBrushcxx . . $ QBrush# m_brushcxx . . $ QetShapeItem#m_brush.; |
| 146 | QPointFcxx . . $ QPointF# m_P1cxx . . $ QetShapeItem#m_P1., |
| 147 | m_P2cxx . . $ QetShapeItem#m_P2., |
| 148 | m_old_P1cxx . . $ QetShapeItem#m_old_P1., |
| 149 | m_old_P2cxx . . $ QetShapeItem#m_old_P2., |
| 150 | m_context_menu_poscxx . . $ QetShapeItem#m_context_menu_pos.; |
| 151 | QPolygonFcxx . . $ QPolygonF# m_polygoncxx . . $ QetShapeItem#m_polygon., m_old_polygoncxx . . $ QetShapeItem#m_old_polygon.; |
| 152 | bool m_hoveredcxx . . $ QetShapeItem#m_hovered.; |
| 153 | int m_vector_indexcxx . . $ QetShapeItem#m_vector_index.; |
| 154 | bool m_closedcxx . . $ QetShapeItem#m_closed. = false, |
| 155 | m_modifie_radius_equalycxx . . $ QetShapeItem#m_modifie_radius_equaly. = false; |
| 156 | int m_resize_modecxx . . $ QetShapeItem#m_resize_mode. = 1; |
| 157 | QVectorcxx . . $ QVector#<QetGraphicsHandlerItemcxx . . $ QetGraphicsHandlerItem# *> m_handler_vectorcxx . . $ QetShapeItem#m_handler_vector.; |
| 158 | QActioncxx . . $ QAction# *m_insert_pointcxx . . $ QetShapeItem#m_insert_point., |
| 159 | *m_remove_pointcxx . . $ QetShapeItem#m_remove_point.; |
| 160 | qrealcxx . . $ qreal# m_xRadiuscxx . . $ QetShapeItem#m_xRadius. = 0, |
| 161 | m_yRadiuscxx . . $ QetShapeItem#m_yRadius. = 0, |
| 162 | m_old_xRadiuscxx . . $ QetShapeItem#m_old_xRadius., |
| 163 | m_old_yRadiuscxx . . $ QetShapeItem#m_old_yRadius.; |
| 164 | }; |
| 165 | #endif // QETSHAPEITEM_H |