QElectroTech
0.8-dev
|
The QetShapeItem class this class is used to draw a basic shape (line, rectangle, ellipse) into a diagram, that can be saved to .qet file. More...
#include <qetshapeitem.h>
Public Types | |
enum | ShapeType { Line =1, Rectangle =2, Ellipse =4, Polygon =8 } |
enum | { Type = UserType + 1008 } |
Signals | |
void | penChanged () |
void | brushChanged () |
void | closeChanged () |
void | XRadiusChanged () |
void | YRadiusChanged () |
Public Member Functions | |
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. More... | |
~QetShapeItem () override | |
int | type () const override |
QPen | pen () const |
METHODS. More... | |
void | setPen (const QPen &pen) |
QetShapeItem::setPen Set the pen to use for draw the shape. More... | |
QBrush | brush () const |
void | setBrush (const QBrush &brush) |
QetShapeItem::setBrush Set the brush to use for the fill the shape. More... | |
ShapeType | shapeType () const |
virtual bool | fromXml (const QDomElement &) |
QetShapeItem::fromXml Build this item from the xml description. More... | |
virtual QDomElement | toXml (QDomDocument &document) const |
QetShapeItem::toXml Save this item to xml element. More... | |
virtual bool | toDXF (const QString &filepath, const QPen &pen) |
QetShapeItem::toDXF Draw this element to the dxf document. More... | |
void | editProperty () override |
QetShapeItem::editProperty Edit the property of this item. More... | |
QString | name () const override |
QetShapeItem::name. More... | |
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. More... | |
QLineF | line () const |
bool | setLine (const QLineF &line) |
QetShapeItem::setLine Set item geometry to line (only available for line shape) More... | |
QRectF | rect () const |
bool | setRect (const QRectF &rect) |
QetShapeItem::setRect Set this item geometry to rect (only available if shape is a rectangle or an ellipse) More... | |
QPolygonF | polygon () const |
bool | setPolygon (const QPolygonF &polygon) |
QetShapeItem::setPolygon Set this item geometry to polygon (only available if shape is a polyline) More... | |
bool | isClosed () const |
void | setClosed (bool close) |
QetShapeItem::setClosed Close this item, have effect only if this item is a polygon. More... | |
qreal | XRadius () const |
void | setXRadius (qreal X) |
qreal | YRadius () const |
void | setYRadius (qreal Y) |
int | pointsCount () const |
QetShapeItem::pointCount. More... | |
void | setNextPoint (QPointF P) |
QetShapeItem::setNextPoint Add a new point to the curent polygon. More... | |
void | removePoints (int number=1) |
QetShapeItem::removePoints Number of point to remove on the polygon If number is superior to number of polygon points-2, all points of polygon will be removed except the first two (minimum point for the polygon);. More... | |
QRectF | boundingRect () const override |
QetShapeItem::boundingRect. More... | |
QPainterPath | shape () const override |
QetShapeItem::shape. More... | |
Public Member Functions inherited from QetGraphicsItem | |
QetGraphicsItem (QGraphicsItem *parent=nullptr) | |
QetGraphicsItem::QetGraphicsItem Default constructor. More... | |
~QetGraphicsItem () override=0 | |
Diagram * | diagram () const |
virtual void | setPos (const QPointF &p) |
virtual void | setPos (qreal x, qreal y) |
virtual bool | isMovable () const |
virtual void | setMovable (bool movable) |
QET::GraphicsItemState | state () const |
QetGraphicsItem::state. More... | |
Protected Member Functions | |
void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override |
QetShapeItem::paint Paint this item. More... | |
void | hoverEnterEvent (QGraphicsSceneHoverEvent *event) override |
QetShapeItem::hoverEnterEvent Handle hover enter event. More... | |
void | hoverLeaveEvent (QGraphicsSceneHoverEvent *event) override |
QetShapeItem::hoverLeaveEvent Handle hover leave event. More... | |
void | mousePressEvent (QGraphicsSceneMouseEvent *event) override |
QVariant | itemChange (GraphicsItemChange change, const QVariant &value) override |
QetShapeItem::itemChange. More... | |
bool | sceneEventFilter (QGraphicsItem *watched, QEvent *event) override |
QetShapeItem::sceneEventFilter. More... | |
void | contextMenuEvent (QGraphicsSceneContextMenuEvent *event) override |
QetShapeItem::contextMenuEvent. More... | |
Protected Member Functions inherited from QetGraphicsItem | |
void | mousePressEvent (QGraphicsSceneMouseEvent *event) override |
void | mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) override |
void | mouseMoveEvent (QGraphicsSceneMouseEvent *event) override |
void | mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override |
QetGraphicsItem::mouseReleaseEvent handle mouse release click. More... | |
Properties | |
QPen | pen |
QBrush | brush |
QRectF | rect |
QLineF | line |
QPolygonF | polygon |
bool | close |
qreal | xRadius |
qreal | yRadius |
Private Member Functions | |
void | switchResizeMode () |
QetShapeItem::switchResizeMode. More... | |
void | addHandler () |
void | adjusteHandlerPos () |
QetShapeItem::adjusteHandlerPos Adjust the position of the handler item. More... | |
void | insertPoint () |
void | removePoint () |
void | handlerMousePressEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event) |
QetShapeItem::handlerMousePressEvent. More... | |
void | handlerMouseMoveEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event) |
QetShapeItem::handlerMouseMoveEvent. More... | |
void | handlerMouseReleaseEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event) |
QetShapeItem::handlerMouseReleaseEvent. More... | |
Private Attributes | |
ShapeType | m_shapeType |
ATTRIBUTES. More... | |
QPen | m_pen |
QBrush | m_brush |
QPointF | m_P1 |
QPointF | m_P2 |
QPointF | m_old_P1 |
QPointF | m_old_P2 |
QPointF | m_context_menu_pos |
QPolygonF | m_polygon |
QPolygonF | m_old_polygon |
bool | m_hovered |
int | m_vector_index |
bool | m_closed = false |
bool | m_modifie_radius_equaly = false |
int | m_resize_mode = 1 |
QVector< QetGraphicsHandlerItem * > | m_handler_vector |
QAction * | m_insert_point |
QAction * | m_remove_point |
qreal | m_xRadius = 0 |
qreal | m_yRadius = 0 |
qreal | m_old_xRadius |
qreal | m_old_yRadius |
Additional Inherited Members | |
Protected Attributes inherited from QetGraphicsItem | |
bool | is_movable_ |
bool | m_first_move |
bool | snap_to_grid_ |
QPointF | m_mouse_to_origin_movement |
QET::GraphicsItemState | m_state = QET:: GIOK |
The QetShapeItem class this class is used to draw a basic shape (line, rectangle, ellipse) into a diagram, that can be saved to .qet file.
QetShapeItem::QetShapeItem | ( | QPointF | p1, |
QPointF | p2 = QPointF(0,0) , |
||
ShapeType | type = Line , |
||
QGraphicsItem * | parent = nullptr |
||
) |
QetShapeItem::QetShapeItem Constructor of shape item. point 1 and 2 must be in scene coordinate.
p1 | first point |
p2 | second point |
type | type of item (line, rectangle, ellipse) |
parent | parent item |
|
override |
|
private |
|
private |
QetShapeItem::adjusteHandlerPos Adjust the position of the handler item.
|
override |
|
inline |
|
signal |
|
signal |
|
overrideprotected |
|
overridevirtual |
QetShapeItem::editProperty Edit the property of this item.
Reimplemented from QetGraphicsItem.
|
virtual |
QetShapeItem::fromXml Build this item from the xml description.
e | element where is stored this item |
|
private |
QetShapeItem::handlerMouseMoveEvent.
qghi | |
event |
|
private |
QetShapeItem::handlerMousePressEvent.
qghi | |
event |
|
private |
QetShapeItem::handlerMouseReleaseEvent.
qghi | |
event |
|
overrideprotected |
QetShapeItem::hoverEnterEvent Handle hover enter event.
event |
|
overrideprotected |
QetShapeItem::hoverLeaveEvent Handle hover leave event.
event |
|
private |
|
inline |
|
overrideprotected |
|
inline |
|
overrideprotected |
|
overridevirtual |
Reimplemented from QetGraphicsItem.
|
overrideprotected |
QetShapeItem::paint Paint this item.
painter | |
option | |
widget |
|
inline |
METHODS.
|
signal |
int QetShapeItem::pointsCount | ( | ) | const |
QetShapeItem::pointCount.
|
inline |
|
inline |
|
private |
void QetShapeItem::removePoints | ( | int | number = 1 | ) |
QetShapeItem::removePoints Number of point to remove on the polygon If number is superior to number of polygon points-2, all points of polygon will be removed except the first two (minimum point for the polygon);.
|
overrideprotected |
QetShapeItem::sceneEventFilter.
watched | |
event |
void QetShapeItem::setBrush | ( | const QBrush & | brush | ) |
QetShapeItem::setBrush Set the brush to use for the fill the shape.
brush |
void QetShapeItem::setClosed | ( | bool | close | ) |
QetShapeItem::setClosed Close this item, have effect only if this item is a polygon.
close |
bool QetShapeItem::setLine | ( | const QLineF & | line | ) |
QetShapeItem::setLine Set item geometry to line (only available for line shape)
line |
void QetShapeItem::setNextPoint | ( | QPointF | P | ) |
QetShapeItem::setNextPoint Add a new point to the curent polygon.
P | the new point. |
void QetShapeItem::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.
P2 |
void QetShapeItem::setPen | ( | const QPen & | pen | ) |
QetShapeItem::setPen Set the pen to use for draw the shape.
pen |
bool QetShapeItem::setPolygon | ( | const QPolygonF & | polygon | ) |
QetShapeItem::setPolygon Set this item geometry to polygon (only available if shape is a polyline)
polygon | : new polygon |
bool QetShapeItem::setRect | ( | const QRectF & | rect | ) |
QetShapeItem::setRect Set this item geometry to rect (only available if shape is a rectangle or an ellipse)
rect | : new rect |
void QetShapeItem::setXRadius | ( | qreal | X | ) |
void QetShapeItem::setYRadius | ( | qreal | Y | ) |
|
override |
|
inline |
|
private |
QetShapeItem::switchResizeMode.
|
virtual |
QetShapeItem::toDXF Draw this element to the dxf document.
filepath | file path of the the dxf document |
pen |
|
virtual |
QetShapeItem::toXml Save this item to xml element.
document | parent document xml |
|
inlineoverride |
|
inline |
|
signal |
|
inline |
|
signal |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
ATTRIBUTES.
|
private |
|
private |
|
private |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |