22 #include <QGraphicsPathItem> 46 Q_PROPERTY(QPointF
pos READ
pos WRITE setPos)
64 enum {
Type = UserType + 1001 };
85 void paint(QPainter *,
const QStyleOptionGraphicsItem *, QWidget *)
override;
87 QPainterPath
shape()
const override;
94 QPainterPath
path()
const;
99 QDomElement
toXml (QDomDocument &, QHash<Terminal *, int> &)
const;
142 QVariant
itemChange(GraphicsItemChange,
const QVariant &)
override;
195 QList<ConductorBend>
bends()
const;
200 static int getCoeff(
const qreal &,
const qreal &);
201 static int getSign(
const qreal &);
202 QHash<ConductorSegmentProfile *, qreal>
shareOffsetBetweenSegments(
const qreal &offset,
const QList<ConductorSegmentProfile *> &,
const qreal & = 0.01)
const;
204 static Qt::Corner
movementType(
const QPointF &,
const QPointF &);
213 template <
typename T>
215 return (b <= c)? (a >= b && a <= c) : (a <= b && a >= c);
QDomElement toXml(QDomDocument &, QHash< Terminal *, int > &) const
void generateConductorPath(const QPointF &, Qet::Orientation, const QPointF &, Qet::Orientation)
QVariant itemChange(GraphicsItemChange, const QVariant &) override
Conductor::itemChange.
void refreshText()
Conductor::refreshText Refresh the text of this conductor. recalcule and set the text according to th...
ConductorProfilesGroup conductor_profiles
bool isBetween(const T a, const T b, const T c)
void saveProfile(bool=true)
QETDiagramEditor * diagramEditor() const
Conductor::diagramEditor.
The QetGraphicsHandlerItem class This graphics item represents a point, destined to be used as an han...
bool modified_path
Whether the conductor was manually modified by users.
autonum::sequentialNumbers m_autoNum_seq
QList< QPointF > segmentsToPoints() const
void setFreezeLabel(bool freeze)
Conductor::setFreezeLabel Freeze this conductor label if true Unfreeze this conductor label if false...
QSet< Conductor * > relatedPotentialConductors(const bool all_diagram=true, QList< Terminal *> *t_list=nullptr)
Conductor::relatedPotentialConductors Return all conductors at the same potential of this conductor...
ConductorProfilesGroup profiles() const
static bool pen_and_brush_initialized
bool fromXml(QDomElement &)
Conductor::fromXml Load the conductor and her information from xml element.
QList< ConductorBend > bends() const
ConductorProfile profile(Qt::Corner) const
bool m_moving_segment
Attributs related to mouse interaction.
ConductorSegment * segments
Segments composing the conductor.
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override
Conductor::mouseDoubleClickEvent Manage the mouse double click.
int type() const override
QPointF posForText(Qt::Orientations &flag)
Conductor::posForText Calculate and return the better pos for text.
void handlerMouseMoveEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
Conductor::handlerMouseMoveEvent.
bool pathFromXml(const QDomElement &)
Conductor::pathFromXml Generate the path from xml file.
QRectF boundingRect() const override
Conductor::boundingRect.
QHash< ConductorSegmentProfile *, qreal > shareOffsetBetweenSegments(const qreal &offset, const QList< ConductorSegmentProfile *> &, const qreal &=0.01) const
void setPath(const QPainterPath &path)
QList< QPointF > junctions() const
void setProperties(const ConductorProperties &property)
void setPropertyToPotential(const ConductorProperties &property, bool only_text=false)
Conductor::setPropertiesToPotential.
virtual void setHighlighted(Highlight)
static int getCoeff(const qreal &, const qreal &)
ConductorSegmentType
Known kinds of conductor segments.
QPointF before_mov_text_pos_
void addHandler()
Conductor::addHandler Add handlers for this item.
QHash< Qt::Corner, ConductorProfile > ConductorProfilesGroup
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override
Diagram * diagram() const
ConductorSegment * middleSegment()
autonum::sequentialNumbers & rSequenceNum()
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override
Conductor::mouseReleaseEvent.
QPainterPath path() const
ConductorTextItem * textItem() const
const QList< ConductorSegment * > segmentsList() const
ConductorSegment * m_moved_segment
void segmentsToPath()
Conductor::segmentsToPath Generate the QPainterPath from the list of points.
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override
Conductor::hoverLeaveEvent Manage the mouse leave event.
bool isValid() const
Conductor::isValid.
void setUpConnectionForFormula(QString old_formula, QString new_formula)
Conductor::setUpConnectionForFormula setup connection according to the variable of formula...
void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override
Conductor::hoverEnterEvent Manage the hover enter event.
static bool valideXml(QDomElement &)
void pointsToSegments(const QList< QPointF > &)
void removeHandler()
Conductor::removeHandler Remove the handlers of this item.
QVector< QPointF > handlerPoints() const
Conductor::handlerPoints.
ConductorTextItem * m_text_item
Text input for non simple, non-singleline conductors.
uint segmentsCount(QET::ConductorSegmentType=QET::Both) const
ConductorProperties m_properties
Functional properties.
void setProfile(const ConductorProfile &, Qt::Corner)
qreal length() const
Conductor::length.
void editProperty()
Conductor::editProperty.
void handlerMousePressEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
Conductor::handlerMousePressEvent.
QVector< QetGraphicsHandlerItem * > m_handler_vector
void handlerMouseReleaseEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
Conductor::handlerMouseReleaseEvent.
Highlight must_highlight_
Define whether and how the conductor should be highlighted.
void calculateTextItemPosition()
Conductor::calculateTextItemPosition Move the text at middle of conductor (if is vertical or horizont...
static Qt::Corner movementType(const QPointF &, const QPointF &)
static QBrush conductor_brush
static QPen conductor_pen
QPen et QBrush objects used to draw conductors.
QPainterPath shape() const override
Conductor::shape.
QPair< QPointF, Qt::Corner > ConductorBend
void mousePressEvent(QGraphicsSceneMouseEvent *event) override
Conductor::mousePressEvent Manage the mouse press event.
virtual QPainterPath nearShape() const
Conductor::nearShape.
static QPointF movePointIntoPolygon(const QPointF &, const QPainterPath &)
bool has_to_save_profile
Whether the current profile should be saved as soon as possible.
static int getSign(const qreal &)
void updatePath(const QRectF &=QRectF())
autonum::sequentialNumbers sequenceNum() const
ConductorProperties properties() const
void adjusteHandlerPos()
Conductor::adjusteHandlerPos Adjust the position of the handler item.
void setSequenceNum(const autonum::sequentialNumbers &sn)
static QPointF extendTerminal(const QPointF &, Qet::Orientation, qreal=9.0)
void displayedTextChanged()
Conductor::displayedTextChanged Update the properties (text) of this conductor and other conductors a...
Conductor * longuestConductorInPotential(Conductor *conductor, bool all_diagram=false)
longuestConductorInPotential
Qt::Corner currentPathType() const
void setProfiles(const ConductorProfilesGroup &)
Conductor::setProfiles.
void deleteSegments()
Supprime les segments.
QList< Conductor * > relatedConductors(const Conductor *conductor)
relatedConductors
Orientation
Orientation (used for electrical elements and their terminals)
virtual Highlight highlight() const
void updatePathAnimate(const int=1)
void updateConductorPath(const QPointF &, Qet::Orientation, const QPointF &, Qet::Orientation)
bool sceneEventFilter(QGraphicsItem *watched, QEvent *event) override
Conductor::sceneEventFilter.