QElectroTech
0.70
|
#include <partrectangle.h>
Public Types | |
enum | { Type = UserType + 1109 } |
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 } |
Signals | |
void | rectChanged () |
void | XRadiusChanged () |
void | YRadiusChanged () |
Public Member Functions | |
PartRectangle (QETElementEditor *, QGraphicsItem *parent=nullptr) | |
PartRectangle::PartRectangle Constructor. More... | |
~PartRectangle () override | |
PartRectangle::~PartRectangle. More... | |
int | type () const override |
void | paint (QPainter *, const QStyleOptionGraphicsItem *, QWidget *=nullptr) override |
PartRectangle::paint Draw this Rectangle. More... | |
QString | name () const override |
QString | xmlName () const override |
const QDomElement | toXml (QDomDocument &) const override |
PartRectangle::toXml Export this rectangle in xml. More... | |
void | fromXml (const QDomElement &) override |
PartRectangle::fromXml Import the properties of this rectangle from a xml element. More... | |
QRectF | rect () const |
void | setRect (const QRectF &rect) |
PartRectangle::setRect Sets the item's rectangle to be the given rectangle. More... | |
qreal | XRadius () const |
void | setXRadius (qreal X) |
qreal | YRadius () const |
void | setYRadius (qreal Y) |
QRectF | sceneGeometricRect () const override |
PartRectangle::sceneGeometricRect. More... | |
virtual QPointF | sceneTopLeft () const |
PartRectangle::sceneTopLeft. More... | |
QPainterPath | shape () const override |
PartRectangle::shape. More... | |
QPainterPath | shadowShape () const override |
QRectF | boundingRect () const override |
PartRectangle::boundingRect. More... | |
bool | isUseless () const override |
PartRectangle::isUseless. More... | |
void | startUserTransformation (const QRectF &) override |
PartRectangle::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 |
PartRectangle::handleUserTransformation Handle the user-induced transformation from initial_selection_rect to new_selection_rect. More... | |
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 |
PartRectangle::mouseReleaseEvent Handle mouse release event. More... | |
QVariant | itemChange (GraphicsItemChange change, const QVariant &value) override |
PartRectangle::itemChange. More... | |
bool | sceneEventFilter (QGraphicsItem *watched, QEvent *event) override |
PartRectangle::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 > &) |
Properties | |
QRectF | rect |
PartRectangle::rect. More... | |
qreal | xRadius |
qreal | yRadius |
Properties inherited from CustomElementGraphicPart | |
LineStyle | line_style |
LineWeight | line_weight |
Filling | filling |
Color | color |
bool | antialias |
Private Member Functions | |
PartRectangle (const PartRectangle &) | |
void | switchResizeMode () |
PartRectangle::switchResizeMode. More... | |
void | adjusteHandlerPos () |
PartRectangle::adjusteHandlerPos. More... | |
void | handlerMousePressEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event) |
PartRectangle::handlerMousePressEvent. More... | |
void | handlerMouseMoveEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event) |
PartRectangle::handlerMouseMoveEvent. More... | |
void | handlerMouseReleaseEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event) |
void | sceneSelectionChanged () |
PartRectangle::sceneSelectionChanged When the scene selection change, if there are several primitive selected, we remove the handler of this item. More... | |
void | addHandler () |
PartRectangle::addHandler Add handlers for this item. More... | |
void | removeHandler () |
PartRectangle::removeHandler Remove the handlers of this item. More... | |
Private Attributes | |
QRectF | m_rect |
QRectF | m_old_rect |
QList< QPointF > | saved_points_ |
int | m_resize_mode = 1 |
int | m_vector_index = -1 |
QVector< QetGraphicsHandlerItem * > | m_handler_vector |
qreal | m_xRadius = 0 |
qreal | m_yRadius = 0 |
qreal | m_old_xRadius |
qreal | m_old_yRadius |
bool | m_modifie_radius_equaly = false |
Additional Inherited Members | |
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 CustomElementGraphicPart | |
bool | m_hovered |
This class represents a rectangle primitive which may be used to compose the drawing of an electrical element within the element editor. All coordinates is in item coordinate, except pos()
Definition at line 30 of file partrectangle.h.
anonymous enum |
Enumerator | |
---|---|
Type |
Definition at line 53 of file partrectangle.h.
PartRectangle::PartRectangle | ( | QETElementEditor * | editor, |
QGraphicsItem * | parent = nullptr |
||
) |
PartRectangle::PartRectangle Constructor.
editor | the QETElementEditor of this item |
parent | parent item |
Definition at line 30 of file partrectangle.cpp.
|
override |
PartRectangle::~PartRectangle.
Definition at line 37 of file partrectangle.cpp.
References removeHandler().
|
private |
|
private |
PartRectangle::addHandler Add handlers for this item.
Definition at line 514 of file partrectangle.cpp.
References CustomElementGraphicPart::color(), QetGraphicsHandlerItem::handlerForPoint(), m_handler_vector, m_rect, m_resize_mode, m_xRadius, m_yRadius, QetGraphicsHandlerUtility::pointForRadiusRect(), and QetGraphicsHandlerUtility::pointsForRect().
Referenced by adjusteHandlerPos(), itemChange(), sceneSelectionChanged(), and switchResizeMode().
|
private |
PartRectangle::adjusteHandlerPos.
Definition at line 390 of file partrectangle.cpp.
References addHandler(), m_handler_vector, m_rect, m_resize_mode, m_xRadius, m_yRadius, QetGraphicsHandlerUtility::pointForRadiusRect(), and QetGraphicsHandlerUtility::pointsForRect().
Referenced by handlerMouseMoveEvent(), itemChange(), setRect(), setXRadius(), and setYRadius().
|
override |
Definition at line 213 of file partrectangle.cpp.
References m_rect, CustomElementGraphicPart::penWeight(), and SHADOWS_HEIGHT.
Referenced by sceneGeometricRect().
|
overridevirtual |
PartRectangle::fromXml Import the properties of this rectangle from a xml element.
qde | : Xml document to use. |
Implements CustomElementPart.
Definition at line 111 of file partrectangle.cpp.
References rect(), setRect(), setXRadius(), setYRadius(), and CustomElementGraphicPart::stylesFromXml().
|
private |
PartRectangle::handlerMouseMoveEvent.
qghi | |
event |
Definition at line 442 of file partrectangle.cpp.
References adjusteHandlerPos(), CustomElementPart::elementScene(), m_modifie_radius_equaly, m_rect, m_resize_mode, m_vector_index, QetGraphicsHandlerUtility::mirrorRectForPosAtIndex(), QetGraphicsHandlerUtility::radiusForPosAtIndex(), QetGraphicsHandlerUtility::rectForPosAtIndex(), setRect(), setXRadius(), setYRadius(), and ElementScene::snapToGrid().
Referenced by sceneEventFilter().
|
private |
PartRectangle::handlerMousePressEvent.
qghi | |
event |
Definition at line 424 of file partrectangle.cpp.
References m_modifie_radius_equaly, m_old_rect, m_old_xRadius, m_old_yRadius, m_rect, m_xRadius, and m_yRadius.
Referenced by sceneEventFilter().
|
private |
Definition at line 473 of file partrectangle.cpp.
References CustomElementPart::elementScene(), m_modifie_radius_equaly, m_old_rect, m_old_xRadius, m_old_yRadius, m_rect, m_vector_index, m_xRadius, m_yRadius, QPropertyUndoCommand::setAnimated(), and ElementScene::undoStack().
Referenced by sceneEventFilter().
|
overridevirtual |
PartRectangle::handleUserTransformation Handle the user-induced transformation from initial_selection_rect to new_selection_rect.
initial_selection_rect | |
new_selection_rect |
Implements CustomElementPart.
Definition at line 255 of file partrectangle.cpp.
References CustomElementPart::mapPoints(), saved_points_, and setRect().
|
overridevirtual |
Implements CustomElementPart.
Definition at line 231 of file partrectangle.cpp.
References rect().
|
overrideprotected |
change | |
value |
Definition at line 280 of file partrectangle.cpp.
References addHandler(), adjusteHandlerPos(), removeHandler(), and sceneSelectionChanged().
|
overrideprotected |
PartRectangle::mouseReleaseEvent Handle mouse release event.
event |
Definition at line 266 of file partrectangle.cpp.
References CustomElementGraphicPart::mouseReleaseEvent(), and switchResizeMode().
|
inlineoverridevirtual |
Implements CustomElementPart.
Definition at line 60 of file partrectangle.h.
References QET::Icons::tr.
|
override |
PartRectangle::paint Draw this Rectangle.
painter | |
options | |
widget |
Definition at line 48 of file partrectangle.cpp.
References CustomElementGraphicPart::applyStylesToQPainter(), CustomElementGraphicPart::drawCross(), CustomElementGraphicPart::drawShadowShape(), CustomElementGraphicPart::m_hovered, m_rect, m_xRadius, m_yRadius, and rect().
QRectF PartRectangle::rect | ( | ) | const |
Referenced by fromXml(), isUseless(), paint(), sceneGeometricRect(), sceneTopLeft(), setRect(), startUserTransformation(), and toXml().
|
signal |
Referenced by RectangleEditor::setPart(), and setRect().
|
private |
PartRectangle::removeHandler Remove the handlers of this item.
Definition at line 544 of file partrectangle.cpp.
References m_handler_vector.
Referenced by itemChange(), sceneSelectionChanged(), and ~PartRectangle().
|
overrideprotected |
PartRectangle::sceneEventFilter.
watched | |
event |
Definition at line 320 of file partrectangle.cpp.
References handlerMouseMoveEvent(), handlerMousePressEvent(), handlerMouseReleaseEvent(), m_handler_vector, m_vector_index, and QetGraphicsHandlerItem::Type.
|
overridevirtual |
PartRectangle::sceneGeometricRect.
Implements CustomElementPart.
Definition at line 170 of file partrectangle.cpp.
References boundingRect(), and rect().
|
private |
PartRectangle::sceneSelectionChanged When the scene selection change, if there are several primitive selected, we remove the handler of this item.
Definition at line 502 of file partrectangle.cpp.
References addHandler(), and removeHandler().
Referenced by itemChange().
|
virtual |
Definition at line 178 of file partrectangle.cpp.
References rect().
Referenced by toXml().
void PartRectangle::setRect | ( | const QRectF & | rect | ) |
PartRectangle::setRect Sets the item's rectangle to be the given rectangle.
rect |
Definition at line 138 of file partrectangle.cpp.
References adjusteHandlerPos(), m_rect, rect(), and rectChanged().
Referenced by fromXml(), handlerMouseMoveEvent(), and handleUserTransformation().
void PartRectangle::setXRadius | ( | qreal | X | ) |
Definition at line 147 of file partrectangle.cpp.
References adjusteHandlerPos(), m_xRadius, and XRadiusChanged().
Referenced by fromXml(), and handlerMouseMoveEvent().
void PartRectangle::setYRadius | ( | qreal | Y | ) |
Definition at line 155 of file partrectangle.cpp.
References adjusteHandlerPos(), m_yRadius, and YRadiusChanged().
Referenced by fromXml(), and handlerMouseMoveEvent().
|
overridevirtual |
Implements CustomElementGraphicPart.
Definition at line 198 of file partrectangle.cpp.
References m_rect, m_xRadius, m_yRadius, CustomElementGraphicPart::penWeight(), and shape().
|
override |
Definition at line 186 of file partrectangle.cpp.
References CustomElementGraphicPart::m_hovered, m_rect, m_xRadius, m_yRadius, CustomElementGraphicPart::penWeight(), and SHADOWS_HEIGHT.
Referenced by shadowShape().
|
overridevirtual |
PartRectangle::startUserTransformation Start the user-induced transformation, provided this primitive is contained within the initial_selection_rect bounding rectangle.
initial_selection_rect |
Implements CustomElementPart.
Definition at line 241 of file partrectangle.cpp.
References rect(), and saved_points_.
|
private |
PartRectangle::switchResizeMode.
Definition at line 357 of file partrectangle.cpp.
References addHandler(), m_handler_vector, and m_resize_mode.
Referenced by mouseReleaseEvent().
|
overridevirtual |
PartRectangle::toXml Export this rectangle in xml.
xml_document | : Xml document to use for create the xml element. |
Implements CustomElementPart.
Definition at line 80 of file partrectangle.cpp.
References m_rect, m_xRadius, m_yRadius, rect(), sceneTopLeft(), and CustomElementGraphicPart::stylesToXml().
|
inlineoverride |
Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a PartRectangle.
Definition at line 58 of file partrectangle.h.
References Type.
|
inlineoverridevirtual |
Implements CustomElementPart.
Definition at line 62 of file partrectangle.h.
|
inline |
Definition at line 68 of file partrectangle.h.
References m_xRadius.
Referenced by RectangleEditor::editingFinished(), and RectangleEditor::updateForm().
|
signal |
Referenced by RectangleEditor::setPart(), and setXRadius().
|
inline |
Definition at line 70 of file partrectangle.h.
References m_yRadius.
Referenced by RectangleEditor::editingFinished(), and RectangleEditor::updateForm().
|
signal |
Referenced by RectangleEditor::setPart(), and setYRadius().
|
private |
Definition at line 106 of file partrectangle.h.
Referenced by addHandler(), adjusteHandlerPos(), removeHandler(), sceneEventFilter(), and switchResizeMode().
|
private |
Definition at line 111 of file partrectangle.h.
Referenced by handlerMouseMoveEvent(), handlerMousePressEvent(), and handlerMouseReleaseEvent().
|
private |
Definition at line 101 of file partrectangle.h.
Referenced by handlerMousePressEvent(), and handlerMouseReleaseEvent().
|
private |
Definition at line 108 of file partrectangle.h.
Referenced by handlerMousePressEvent(), and handlerMouseReleaseEvent().
|
private |
Definition at line 108 of file partrectangle.h.
Referenced by handlerMousePressEvent(), and handlerMouseReleaseEvent().
|
private |
Definition at line 101 of file partrectangle.h.
Referenced by addHandler(), adjusteHandlerPos(), boundingRect(), handlerMouseMoveEvent(), handlerMousePressEvent(), handlerMouseReleaseEvent(), paint(), setRect(), shadowShape(), shape(), and toXml().
|
private |
Definition at line 104 of file partrectangle.h.
Referenced by addHandler(), adjusteHandlerPos(), handlerMouseMoveEvent(), and switchResizeMode().
|
private |
Definition at line 105 of file partrectangle.h.
Referenced by handlerMouseMoveEvent(), handlerMouseReleaseEvent(), and sceneEventFilter().
|
private |
Definition at line 107 of file partrectangle.h.
Referenced by addHandler(), adjusteHandlerPos(), handlerMousePressEvent(), handlerMouseReleaseEvent(), paint(), setXRadius(), shadowShape(), shape(), toXml(), and XRadius().
|
private |
Definition at line 108 of file partrectangle.h.
Referenced by addHandler(), adjusteHandlerPos(), handlerMousePressEvent(), handlerMouseReleaseEvent(), paint(), setYRadius(), shadowShape(), shape(), toXml(), and YRadius().
|
private |
Definition at line 103 of file partrectangle.h.
Referenced by handleUserTransformation(), and startUserTransformation().
|
readwrite |
Definition at line 34 of file partrectangle.h.
Referenced by RectangleEditor::editingFinished(), and ESEventAddRect::mouseMoveEvent().
|
readwrite |
Definition at line 35 of file partrectangle.h.
|
readwrite |
Definition at line 36 of file partrectangle.h.