QElectroTech
0.70
|
The PartArc class This class represents an elliptical arc primitive which may be used to compose the drawing of an electrical element within the element editor. More...
#include <partarc.h>
Public Types | |
enum | { Type = UserType + 1101 } |
Public Types inherited from CustomElementGraphicPart | |
enum | LineStyle { NormalStyle, DashedStyle, DottedStyle, DashdottedStyle } |
enum | LineWeight { NoneWeight, ThinWeight, NormalWeight, UltraWeight, BigWeight } |
enum | Filling { NoneFilling, BlackFilling, WhiteFilling, GreenFilling, RedFilling, BlueFilling, GrayFilling, BrunFilling, YellowFilling, CyanFilling, MagentaFilling, LightgrayFilling, OrangeFilling, PurpleFilling, HorFilling, VerFilling, BdiagFilling, FdiagFilling } |
enum | Color { BlackColor, WhiteColor, GreenColor, RedColor, BlueColor, GrayColor, BrunColor, YellowColor, CyanColor, MagentaColor, LightgrayColor, OrangeColor, PurpleColor, NoneColor } |
Public Member Functions | |
PartArc (QETElementEditor *editor, QGraphicsItem *parent=nullptr) | |
PartArc::PartArc Constructor. More... | |
~PartArc () override | |
PartArc::~PartArc Destructor. More... | |
int | type () const override |
void | paint (QPainter *, const QStyleOptionGraphicsItem *, QWidget *=nullptr) override |
PartArc::paint Draw this arc. More... | |
QString | name () const override |
QString | xmlName () const override |
const QDomElement | toXml (QDomDocument &) const override |
PartArc::toXml Export this arc in xml. More... | |
void | fromXml (const QDomElement &) override |
PartArc::fromXml Import the properties of this arc from a xml element. More... | |
QPainterPath | shape () const override |
PartArc::shape. More... | |
QPainterPath | shadowShape () const override |
void | setRect (const QRectF &rect) override |
AbstractPartEllipse::setRect Sets the item's ellipse geometry to rect. The rectangle's left edge defines the left edge of the ellipse, and the rectangle's top edge describes the top of the ellipse The height and width of the rectangle describe the height and width of the ellipse. More... | |
void | setStartAngle (const int &start_angle) override |
AbstractPartEllipse::setStartAngle Sets the start angle for an ellipse segment to angle, which is in 16ths of a degree. This angle is used together with spanAngle() for representing an ellipse segment (a pie). By default, the start angle is 0. More... | |
void | setSpanAngle (const int &span_angle) override |
AbstractPartEllipse::setSpanAngle Returns the span angle of an ellipse segment in 16ths of a degree. This angle is used together with startAngle() for representing an ellipse segment (a pie). By default, this function returns 5760 (360 * 16, a full ellipse). More... | |
Public Member Functions inherited from AbstractPartEllipse | |
AbstractPartEllipse (QETElementEditor *editor, QGraphicsItem *parent=nullptr) | |
AbstractPartEllipse::AbstractPartEllipse Constructor. More... | |
~AbstractPartEllipse () override | |
AbstractPartEllipse::~AbstractPartEllipse Destructor. More... | |
void | startUserTransformation (const QRectF &) override |
AbstractPartEllipse::startUserTransformation Start the user-induced transformation, provided this primitive is contained within the initial_selection_rect bounding rectangle. More... | |
void | handleUserTransformation (const QRectF &, const QRectF &) override |
AbstractPartEllipse::handleUserTransformation Handle the user-induced transformation from initial_selection_rect to new_selection_rect. More... | |
QRectF | boundingRect () const override |
AbstractPartEllipse::boundingRect Bounding rectangle this part can fit into. More... | |
QRectF | sceneGeometricRect () const override |
AbstractPartEllipse::sceneGeometricRect. More... | |
virtual QPointF | sceneTopLeft () const |
AbstractPartEllipse::sceneTopLeft. More... | |
QRectF | rect () const |
bool | isUseless () const override |
AbstractPartEllipse::isUseless. More... | |
int | startAngle () const |
int | spanAngle () const |
Public Member Functions inherited from CustomElementGraphicPart | |
CustomElementGraphicPart (QETElementEditor *editor, QGraphicsItem *parent=nullptr) | |
CustomElementGraphicPart::CustomElementGraphicPart Default constructor. By default, item is selectable, send geometry change (Qt > 4.6), accept mouse left button and accept hover event. More... | |
~CustomElementGraphicPart () override | |
CustomElementGraphicPart::~CustomElementGraphicPart Destructor. More... | |
LineStyle | lineStyle () const |
void | setLineStyle (const LineStyle ls) |
CustomElementGraphicPart::setLineStyle Set line style to ls. More... | |
LineWeight | lineWeight () const |
void | setLineWeight (const LineWeight lw) |
CustomElementGraphicPart::setLineWeight Set line weight to lw. More... | |
qreal | penWeight () const |
CustomElementGraphicPart::penWeight. More... | |
Filling | filling () const |
void | setFilling (const Filling f) |
CustomElementGraphicPart::setFilling Set filling to f. More... | |
Color | color () const |
void | setColor (const Color c) |
CustomElementGraphicPart::setColor Set color to c. More... | |
bool | antialiased () const |
void | setAntialiased (const bool b) |
CustomElementGraphicPart::setAntialiased Set antialias to b. More... | |
void | setProperty (const char *name, const QVariant &value) override |
QVariant | property (const char *name) const override |
Public Member Functions inherited from CustomElementPart | |
CustomElementPart (QETElementEditor *editor) | |
virtual | ~CustomElementPart () |
Destructor. More... | |
virtual QETElementEditor * | elementEditor () const |
virtual void | updateCurrentPartEditor () const |
virtual ElementScene * | elementScene () const |
virtual QUndoStack & | undoStack () const |
virtual QGraphicsItem * | toItem () |
virtual QET::ScalingMethod | preferredScalingMethod () const |
Protected Member Functions | |
void | mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override |
PartArc::mouseReleaseEvent Handle mouse release event. More... | |
QVariant | itemChange (GraphicsItemChange change, const QVariant &value) override |
PartArc::itemChange. More... | |
bool | sceneEventFilter (QGraphicsItem *watched, QEvent *event) override |
PartArc::sceneEventFilter. More... | |
Protected Member Functions inherited from CustomElementGraphicPart | |
void | stylesToXml (QDomElement &) const |
CustomElementGraphicPart::stylesToXml Write the curent style to xml element. The style are stored like this: name-of-style:value;name-of-style:value Each style separate by ; and name-style/value are separate by : More... | |
void | stylesFromXml (const QDomElement &) |
CustomElementGraphicPart::stylesFromXml Read the style used by this, from a xml element. More... | |
void | resetStyles () |
CustomElementGraphicPart::resetStyles Reset the curent style to default, same style of default constructor. More... | |
void | applyStylesToQPainter (QPainter &) const |
CustomElementGraphicPart::applyStylesToQPainter Apply the current style to the QPainter. More... | |
void | drawShadowShape (QPainter *painter) |
CustomElementGraphicPart::drawShadowShape Draw a transparent blue shadow arround the shape of this item. The QPainterPathStroker used to draw shadows have a width of SHADOWS_HEIGHT Be carefull if penWeight of this item is to 0 the outline of strock is bigger of 0.5. More... | |
QVariant | itemChange (GraphicsItemChange change, const QVariant &value) override |
CustomElementGraphicPart::itemChange Reimplemented from QGraphicsObject. If the item position change call updateCurrentPartEditor() the change is always send to QGraphicsObject. More... | |
void | hoverEnterEvent (QGraphicsSceneHoverEvent *event) override |
CustomElementGraphicPart::hoverEnterEvent Reimplemented from QGraphicsObject. Set m_hovered to true. More... | |
void | hoverLeaveEvent (QGraphicsSceneHoverEvent *event) override |
CustomElementGraphicPart::hoverLeaveEvent Reimplemented from QGraphicsObject. Set m_hovered to false. More... | |
void | mousePressEvent (QGraphicsSceneMouseEvent *event) override |
void | mouseMoveEvent (QGraphicsSceneMouseEvent *event) override |
void | mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override |
Protected Member Functions inherited from CustomElementPart | |
QList< QPointF > | mapPoints (const QRectF &, const QRectF &, const QList< QPointF > &) |
Private Member Functions | |
PartArc (const PartArc &) | |
void | switchResizeMode () |
PartArc::switchResizeMode. More... | |
void | adjusteHandlerPos () |
PartArc::adjusteHandlerPos. More... | |
void | handlerMousePressEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event) |
PartArc::handlerMousePressEvent. More... | |
void | handlerMouseMoveEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event) |
PartArc::handlerMouseMoveEvent. More... | |
void | handlerMouseReleaseEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event) |
PartArc::handlerMouseReleaseEvent. More... | |
void | sceneSelectionChanged () |
PartArc::sceneSelectionChanged When the scene selection change, if there are several primitive selected, we remove the handler of this item. More... | |
void | addHandler () |
PartArc::addHandler Add handlers for this item. More... | |
void | removeHandler () |
PartArc::removeHandler Remove the handlers of this item. More... | |
Private Attributes | |
QPropertyUndoCommand * | m_undo_command = nullptr |
QPropertyUndoCommand * | m_undo_command2 = nullptr |
int | m_resize_mode = 1 |
int | m_vector_index = -1 |
QPointF | m_span_point |
QVector< QetGraphicsHandlerItem * > | m_handler_vector |
Additional Inherited Members | |
Signals inherited from AbstractPartEllipse | |
void | rectChanged () |
void | startAngleChanged () |
void | spanAngleChanged () |
Static Public Member Functions inherited from CustomElementGraphicPart | |
static void | drawCross (const QPointF ¢er, QPainter *painter) |
CustomElementGraphicPart::drawCross Draw a cross at pos center. More... | |
Protected Attributes inherited from AbstractPartEllipse | |
QList< QPointF > | saved_points_ |
QRectF | m_rect |
qreal | m_start_angle |
qreal | m_span_angle |
QVector< QetGraphicsHandlerItem * > | m_handler_vector |
Protected Attributes inherited from CustomElementGraphicPart | |
bool | m_hovered |
Properties inherited from AbstractPartEllipse | |
int | startAngle |
int | spanAngle |
QRectF | rect |
AbstractPartEllipse::rect Returns the item's ellipse geometry as a QRectF. More... | |
Properties inherited from CustomElementGraphicPart | |
LineStyle | line_style |
LineWeight | line_weight |
Filling | filling |
Color | color |
bool | antialias |
The PartArc class This class represents an elliptical arc primitive which may be used to compose the drawing of an electrical element within the element editor.
PartArc::PartArc | ( | QETElementEditor * | editor, |
QGraphicsItem * | parent = nullptr |
||
) |
PartArc::PartArc Constructor.
editor | : QETElementEditor of this part |
parent | : parent item |
Definition at line 31 of file partarc.cpp.
References AbstractPartEllipse::m_span_angle, and AbstractPartEllipse::m_start_angle.
|
override |
PartArc::~PartArc Destructor.
Definition at line 42 of file partarc.cpp.
References m_undo_command, and removeHandler().
|
private |
|
private |
PartArc::addHandler Add handlers for this item.
Definition at line 439 of file partarc.cpp.
References CustomElementGraphicPart::color(), QetGraphicsHandlerItem::handlerForPoint(), m_handler_vector, AbstractPartEllipse::m_rect, m_resize_mode, AbstractPartEllipse::m_span_angle, AbstractPartEllipse::m_start_angle, QetGraphicsHandlerUtility::pointsForArc(), and QetGraphicsHandlerUtility::pointsForRect().
Referenced by itemChange(), sceneSelectionChanged(), and switchResizeMode().
|
private |
Definition at line 288 of file partarc.cpp.
References m_handler_vector, AbstractPartEllipse::m_rect, m_resize_mode, AbstractPartEllipse::m_span_angle, AbstractPartEllipse::m_start_angle, QetGraphicsHandlerUtility::pointsForArc(), and QetGraphicsHandlerUtility::pointsForRect().
Referenced by itemChange(), setRect(), setSpanAngle(), and setStartAngle().
|
overridevirtual |
PartArc::fromXml Import the properties of this arc from a xml element.
qde | : Xml document to use. |
Implements CustomElementPart.
Definition at line 117 of file partarc.cpp.
References AbstractPartEllipse::m_rect, AbstractPartEllipse::m_span_angle, AbstractPartEllipse::m_start_angle, and CustomElementGraphicPart::stylesFromXml().
|
private |
PartArc::handlerMouseMoveEvent.
qghi | |
event |
Definition at line 353 of file partarc.cpp.
References CustomElementPart::elementScene(), AbstractPartEllipse::m_rect, m_resize_mode, AbstractPartEllipse::m_span_angle, m_span_point, AbstractPartEllipse::m_start_angle, m_vector_index, QetGraphicsHandlerUtility::mirrorRectForPosAtIndex(), QetGraphicsHandlerUtility::pointsForArc(), QetGraphicsHandlerUtility::rectForPosAtIndex(), setRect(), setSpanAngle(), setStartAngle(), and ElementScene::snapToGrid().
Referenced by sceneEventFilter().
|
private |
PartArc::handlerMousePressEvent.
qghi | |
event |
Definition at line 314 of file partarc.cpp.
References QPropertyUndoCommand::enableAnimation(), AbstractPartEllipse::m_rect, m_resize_mode, AbstractPartEllipse::m_span_angle, m_span_point, AbstractPartEllipse::m_start_angle, m_undo_command, m_undo_command2, m_vector_index, QetGraphicsHandlerUtility::pointsForArc(), and QET::Icons::tr.
Referenced by sceneEventFilter().
|
private |
PartArc::handlerMouseReleaseEvent.
qghi | |
event |
Definition at line 387 of file partarc.cpp.
References CustomElementPart::elementScene(), AbstractPartEllipse::m_rect, m_resize_mode, AbstractPartEllipse::m_span_angle, AbstractPartEllipse::m_start_angle, m_undo_command, m_undo_command2, m_vector_index, QPropertyUndoCommand::setNewValue(), and ElementScene::undoStack().
Referenced by sceneEventFilter().
|
overrideprotected |
change | |
value |
Definition at line 176 of file partarc.cpp.
References addHandler(), adjusteHandlerPos(), removeHandler(), and sceneSelectionChanged().
|
overrideprotected |
PartArc::mouseReleaseEvent Handle mouse release event.
event |
Definition at line 162 of file partarc.cpp.
References CustomElementGraphicPart::mouseReleaseEvent(), and switchResizeMode().
|
inlineoverridevirtual |
Implements CustomElementPart.
Definition at line 52 of file partarc.h.
References QET::Icons::tr.
|
override |
PartArc::paint Draw this arc.
painter | |
options | |
widget |
Definition at line 55 of file partarc.cpp.
References CustomElementGraphicPart::applyStylesToQPainter(), CustomElementGraphicPart::drawCross(), CustomElementGraphicPart::drawShadowShape(), CustomElementGraphicPart::m_hovered, AbstractPartEllipse::m_rect, AbstractPartEllipse::m_span_angle, AbstractPartEllipse::m_start_angle, and AbstractPartEllipse::rect().
|
private |
PartArc::removeHandler Remove the handlers of this item.
Definition at line 470 of file partarc.cpp.
References m_handler_vector.
Referenced by itemChange(), sceneSelectionChanged(), switchResizeMode(), and ~PartArc().
|
overrideprotected |
watched | |
event |
Definition at line 216 of file partarc.cpp.
References handlerMouseMoveEvent(), handlerMousePressEvent(), handlerMouseReleaseEvent(), m_handler_vector, m_vector_index, and QetGraphicsHandlerItem::Type.
|
private |
PartArc::sceneSelectionChanged When the scene selection change, if there are several primitive selected, we remove the handler of this item.
Definition at line 427 of file partarc.cpp.
References addHandler(), and removeHandler().
Referenced by itemChange().
|
inlineoverridevirtual |
AbstractPartEllipse::setRect Sets the item's ellipse geometry to rect. The rectangle's left edge defines the left edge of the ellipse, and the rectangle's top edge describes the top of the ellipse The height and width of the rectangle describe the height and width of the ellipse.
rect |
Reimplemented from AbstractPartEllipse.
Definition at line 59 of file partarc.h.
References adjusteHandlerPos(), AbstractPartEllipse::rect(), and AbstractPartEllipse::setRect().
Referenced by handlerMouseMoveEvent().
|
inlineoverridevirtual |
AbstractPartEllipse::setSpanAngle Returns the span angle of an ellipse segment in 16ths of a degree. This angle is used together with startAngle() for representing an ellipse segment (a pie). By default, this function returns 5760 (360 * 16, a full ellipse).
span_angle |
Reimplemented from AbstractPartEllipse.
Definition at line 61 of file partarc.h.
References adjusteHandlerPos(), and AbstractPartEllipse::setSpanAngle().
Referenced by handlerMouseMoveEvent().
|
inlineoverridevirtual |
AbstractPartEllipse::setStartAngle Sets the start angle for an ellipse segment to angle, which is in 16ths of a degree. This angle is used together with spanAngle() for representing an ellipse segment (a pie). By default, the start angle is 0.
start_angle |
Reimplemented from AbstractPartEllipse.
Definition at line 60 of file partarc.h.
References adjusteHandlerPos(), and AbstractPartEllipse::setStartAngle().
Referenced by handlerMouseMoveEvent(), and ESEventAddArc::updateArc().
|
overridevirtual |
Implements CustomElementGraphicPart.
Definition at line 145 of file partarc.cpp.
References AbstractPartEllipse::m_rect, AbstractPartEllipse::m_span_angle, AbstractPartEllipse::m_start_angle, CustomElementGraphicPart::penWeight(), and shape().
|
override |
Definition at line 132 of file partarc.cpp.
References CustomElementGraphicPart::m_hovered, AbstractPartEllipse::m_rect, AbstractPartEllipse::m_span_angle, AbstractPartEllipse::m_start_angle, CustomElementGraphicPart::penWeight(), and SHADOWS_HEIGHT.
Referenced by shadowShape().
|
private |
Definition at line 253 of file partarc.cpp.
References addHandler(), m_handler_vector, m_resize_mode, and removeHandler().
Referenced by mouseReleaseEvent().
|
overridevirtual |
PartArc::toXml Export this arc in xml.
xml_document | : Xml document to use for create the xml element. |
Implements CustomElementPart.
Definition at line 98 of file partarc.cpp.
References AbstractPartEllipse::m_span_angle, AbstractPartEllipse::m_start_angle, AbstractPartEllipse::rect(), AbstractPartEllipse::sceneTopLeft(), and CustomElementGraphicPart::stylesToXml().
|
inlineoverride |
|
inlineoverridevirtual |
Implements CustomElementPart.
|
private |
Definition at line 85 of file partarc.h.
Referenced by addHandler(), adjusteHandlerPos(), removeHandler(), sceneEventFilter(), and switchResizeMode().
|
private |
Definition at line 82 of file partarc.h.
Referenced by addHandler(), adjusteHandlerPos(), handlerMouseMoveEvent(), handlerMousePressEvent(), handlerMouseReleaseEvent(), and switchResizeMode().
|
private |
Definition at line 84 of file partarc.h.
Referenced by handlerMouseMoveEvent(), and handlerMousePressEvent().
|
private |
Definition at line 80 of file partarc.h.
Referenced by handlerMousePressEvent(), handlerMouseReleaseEvent(), and ~PartArc().
|
private |
Definition at line 81 of file partarc.h.
Referenced by handlerMousePressEvent(), and handlerMouseReleaseEvent().
|
private |
Definition at line 83 of file partarc.h.
Referenced by handlerMouseMoveEvent(), handlerMousePressEvent(), handlerMouseReleaseEvent(), and sceneEventFilter().