18 #ifndef CUSTOM_ELEMENT_GRAPHIC_PART_H 19 #define CUSTOM_ELEMENT_GRAPHIC_PART_H 21 #include <QGraphicsObject> 35 #define SHADOWS_HEIGHT 4.0 55 enum
Filling {
NoneFilling,
BlackFilling,
WhiteFilling,
GreenFilling,
RedFilling,
BlueFilling,
GrayFilling,
BrunFilling,
YellowFilling,
CyanFilling,
MagentaFilling,
LightgrayFilling,
OrangeFilling,
PurpleFilling,
HorFilling,
VerFilling,
BdiagFilling,
FdiagFilling};
59 enum
Color {
BlackColor,
WhiteColor,
GreenColor,
RedColor,
BlueColor,
GrayColor,
BrunColor,
YellowColor,
CyanColor,
MagentaColor,
LightgrayColor,
OrangeColor,
PurpleColor,
NoneColor};
68 static void drawCross (
const QPointF ¢er, QPainter *painter);
90 void setProperty (
const char *
name,
const QVariant &value)
override {QObject::setProperty(
name, value);}
102 QVariant
itemChange(GraphicsItemChange change,
const QVariant &value)
override;
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override
LineWeight lineWeight() const
void setFilling(const Filling f)
CustomElementGraphicPart::setFilling Set filling to f.
QVariant itemChange(GraphicsItemChange change, const QVariant &value) override
CustomElementGraphicPart::itemChange Reimplemented from QGraphicsObject. If the item position change ...
virtual QPainterPath shadowShape() const =0
void setAntialiased(const bool b)
CustomElementGraphicPart::setAntialiased Set antialias to b.
~CustomElementGraphicPart() override
CustomElementGraphicPart::~CustomElementGraphicPart Destructor.
static void drawCross(const QPointF ¢er, QPainter *painter)
CustomElementGraphicPart::drawCross Draw a cross at pos center.
The CustomElementGraphicPart class This class is the base for all home-made primitive like line...
void mousePressEvent(QGraphicsSceneMouseEvent *event) override
void stylesToXml(QDomElement &) const
CustomElementGraphicPart::stylesToXml Write the curent style to xml element. The style are stored lik...
void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override
CustomElementGraphicPart::hoverEnterEvent Reimplemented from QGraphicsObject. Set m_hovered to true...
void resetStyles()
CustomElementGraphicPart::resetStyles Reset the curent style to default, same style of default constr...
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override
QVariant property(const char *name) const override
void setLineStyle(const LineStyle ls)
CustomElementGraphicPart::setLineStyle Set line style to ls.
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override
CustomElementGraphicPart::hoverLeaveEvent Reimplemented from QGraphicsObject. Set m_hovered to false...
void setLineWeight(const LineWeight lw)
CustomElementGraphicPart::setLineWeight Set line weight to lw.
void setProperty(const char *name, const QVariant &value) override
void stylesFromXml(const QDomElement &)
CustomElementGraphicPart::stylesFromXml Read the style used by this, from a xml element.
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.
virtual QString name() const =0
LineStyle lineStyle() const
void setColor(const Color c)
CustomElementGraphicPart::setColor Set color to c.
CustomElementGraphicPart CEGP
qreal penWeight() const
CustomElementGraphicPart::penWeight.
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 it...