QElectroTech 0.100.0-dev
|
The CustomElementGraphicPart class This class is the base for all home-made primitive like line, rectangle, ellipse etc.... It provides methods and enums to manage style attributes available for primitive (color, pen style, etc...) More...
#include <customelementgraphicpart.h>
Public Member Functions | |
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. | |
~CustomElementGraphicPart () override | |
CustomElementGraphicPart::~CustomElementGraphicPart Destructor. | |
LineStyle | lineStyle () const |
void | setLineStyle (const LineStyle ls) |
CustomElementGraphicPart::setLineStyle Set line style to ls. | |
LineWeight | lineWeight () const |
void | setLineWeight (const LineWeight lw) |
CustomElementGraphicPart::setLineWeight Set line weight to lw. | |
qreal | penWeight () const |
CustomElementGraphicPart::penWeight. | |
Filling | filling () const |
void | setFilling (const Filling f) |
CustomElementGraphicPart::setFilling Set filling to f. | |
Color | color () const |
void | setColor (const Color c) |
CustomElementGraphicPart::setColor Set color to c. | |
bool | antialiased () const |
void | setAntialiased (const bool b) |
CustomElementGraphicPart::setAntialiased Set antialias to b. | |
void | setProperty (const char *name, const QVariant &value) override |
QVariant | property (const char *name) const override |
virtual QPainterPath | shadowShape () const =0 |
virtual void | addHandler () |
virtual void | removeHandler () |
virtual void | setHandlerColor (QPointF, const QColor &) |
virtual void | resetAllHandlerColor () |
Public Member Functions inherited from CustomElementPart | |
CustomElementPart (QETElementEditor *editor) | |
CustomElementPart Constructor. | |
virtual | ~CustomElementPart () |
~CustomElementPart Destructor | |
virtual void | fromXml (const QDomElement &)=0 |
virtual const QDomElement | toXml (QDomDocument &) const =0 |
virtual bool | isUseless () const =0 |
virtual QRectF | sceneGeometricRect () const =0 |
virtual void | startUserTransformation (const QRectF &)=0 |
virtual void | handleUserTransformation (const QRectF &, const QRectF &)=0 |
virtual QETElementEditor * | elementEditor () const |
virtual void | updateCurrentPartEditor () const |
virtual ElementScene * | elementScene () const |
virtual QUndoStack & | undoStack () const |
virtual QString | name () const =0 |
virtual QString | xmlName () const =0 |
virtual QGraphicsItem * | toItem () |
virtual QET::ScalingMethod | preferredScalingMethod () const |
Static Public Member Functions | |
static void | drawCross (const QPointF ¢er, QPainter *painter) |
CustomElementGraphicPart::drawCross Draw a cross at pos center. | |
Protected Member Functions | |
void | stylesToXml (QDomElement &) const |
CustomElementGraphicPart::stylesToXml Write the current 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 : | |
void | stylesFromXml (const QDomElement &) |
CustomElementGraphicPart::stylesFromXml Read the style used by this, from a xml element. | |
void | resetStyles () |
CustomElementGraphicPart::resetStyles Reset the current style to default, same style of default constructor. | |
void | applyStylesToQPainter (QPainter &) const |
CustomElementGraphicPart::applyStylesToQPainter Apply the current style to the QPainter. | |
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. | |
void | hoverEnterEvent (QGraphicsSceneHoverEvent *event) override |
CustomElementGraphicPart::hoverEnterEvent Reimplemented from QGraphicsObject. Set m_hovered to true. | |
void | hoverLeaveEvent (QGraphicsSceneHoverEvent *event) override |
CustomElementGraphicPart::hoverLeaveEvent Reimplemented from QGraphicsObject. Set m_hovered to false. | |
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 > &) |
Protected Attributes | |
bool | m_hovered |
Properties | |
LineStyle | line_style |
LineWeight | line_weight |
Filling | filling |
Color | color |
bool | antialias |
Private Attributes | |
LineStyle | _linestyle |
LineWeight | _lineweight |
Filling | _filling |
Color | _color |
bool | _antialiased |
QPointF | m_origin_pos |
bool | m_first_move |
The CustomElementGraphicPart class This class is the base for all home-made primitive like line, rectangle, ellipse etc.... It provides methods and enums to manage style attributes available for primitive (color, pen style, etc...)
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.
editor | QETElement editor that belong this. |
parent |
|
override |
|
inlinevirtual |
Reimplemented in PartArc, PartEllipse, PartLine, PartPolygon, and PartRectangle.
|
inline |
|
protected |
CustomElementGraphicPart::applyStylesToQPainter Apply the current style to the QPainter.
painter |
|
inline |
|
static |
CustomElementGraphicPart::drawCross Draw a cross at pos center.
center | : center of cross |
painter | : painter to use for draw cross, the painter state is restored at end of this method. |
|
protected |
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.
painter | : painter to use for draw this shadows |
|
inline |
|
overrideprotected |
CustomElementGraphicPart::hoverEnterEvent Reimplemented from QGraphicsObject. Set m_hovered to true.
event |
|
overrideprotected |
CustomElementGraphicPart::hoverLeaveEvent Reimplemented from QGraphicsObject. Set m_hovered to false.
event |
|
inline |
|
inline |
|
overrideprotected |
|
overrideprotected |
|
overrideprotected |
qreal CustomElementGraphicPart::penWeight | ( | ) | const |
CustomElementGraphicPart::penWeight.
|
inlineoverridevirtual |
Get the current value of a specific primitive property
Implements CustomElementPart.
|
inlinevirtual |
Reimplemented in PartArc, PartEllipse, PartLine, PartPolygon, and PartRectangle.
|
inlinevirtual |
Reimplemented in PartPolygon.
|
protected |
CustomElementGraphicPart::resetStyles Reset the current style to default, same style of default constructor.
void CustomElementGraphicPart::setAntialiased | ( | const bool | b | ) |
CustomElementGraphicPart::setAntialiased Set antialias to b.
b |
void CustomElementGraphicPart::setColor | ( | const Color | c | ) |
CustomElementGraphicPart::setColor Set color to c.
c |
void CustomElementGraphicPart::setFilling | ( | const Filling | f | ) |
CustomElementGraphicPart::setFilling Set filling to f.
f |
|
inlinevirtual |
Reimplemented in PartPolygon.
void CustomElementGraphicPart::setLineStyle | ( | const LineStyle | ls | ) |
CustomElementGraphicPart::setLineStyle Set line style to ls.
ls |
void CustomElementGraphicPart::setLineWeight | ( | const LineWeight | lw | ) |
CustomElementGraphicPart::setLineWeight Set line weight to lw.
lw |
|
inlineoverridevirtual |
Set a specific property of the primitive
Implements CustomElementPart.
|
pure virtual |
Implemented in PartArc, PartEllipse, PartLine, PartPolygon, PartRectangle, and PartTerminal.
|
protected |
CustomElementGraphicPart::stylesFromXml Read the style used by this, from a xml element.
qde | : QDomElement used to read the style |
|
protected |
CustomElementGraphicPart::stylesToXml Write the current 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 :
qde | : QDOmElement used to write the style. |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
protected |
|
private |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |