21#include <QGraphicsItem>
27class QGraphicsSceneMouseEvent;
37static const int TypeEdge= QGraphicsItem::UserType+2;
51 Q_INTERFACES (QGraphicsItem)
56 const Qt::PenStyle &
style,
57 const int&
type,
const bool & drawArrows,
const bool &bezier,
58 const bool &weightNumbers=
false,
59 const bool &highlighting=
true);
62 enum {
Type = UserType + 2 };
94 QString
label()
const;
110 Qt::PenStyle
style()
const;
112 void setColor(
const QString &str) ;
114 QColor
color()
const;
120 QPainterPath
shape()
const;
128 void paint(QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget);
129 QVariant
itemChange(GraphicsItemChange change,
const QVariant &value);
Definition graphicsedgelabel.h:28
Definition graphicsedgeweight.h:28
Definition graphicsedge.h:49
void showArrows(const bool &)
Toggles displaying edge arrow.
Definition graphicsedge.cpp:126
void setState(const int &state)
Sets the edge state.
Definition graphicsedge.cpp:667
QPointF sourcePoint
Definition graphicsedge.h:145
GraphicsEdgeLabel * edgeLabel
Definition graphicsedge.h:141
QPointF edgeOffset
Definition graphicsedge.h:147
void setColor(const QString &str)
Sets the edge color.
Definition graphicsedge.cpp:148
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
Pains the edge.
Definition graphicsedge.cpp:679
void removeRefs()
Removes any references to this edge in source and target nodes.
Definition graphicsedge.cpp:137
GraphicsEdgeWeight * weightNumber
Definition graphicsedge.h:139
QRectF boundingRect() const
Defines the outer bounds of the edge as a rectangle; All painting will be restricted to inside the ed...
Definition graphicsedge.cpp:579
QString label() const
Returns the edge label text.
Definition graphicsedge.cpp:265
QPainterPath shape() const
Returns the shape of this edge as a QPainterPath in local coordinates. The shape is used for many thi...
Definition graphicsedge.cpp:563
qreal m_arrowSize
Definition graphicsedge.h:149
qreal m_offsetFromTargetNode
Definition graphicsedge.h:152
QVariant itemChange(GraphicsItemChange change, const QVariant &value)
Called when the edge changes, i.e. moves, becomes disabled or changes its visibility.
Definition graphicsedge.cpp:723
GraphicsWidget * graphicsWidget
Definition graphicsedge.h:135
void setLabelVisibility(const bool &toggle)
Toggles the graphics edge label visibility.
Definition graphicsedge.cpp:287
QColor color() const
Returns the edge QColor.
Definition graphicsedge.cpp:158
QString colorToPajek()
Returns the edge color in pajek-accepted format.
Definition graphicsedge.cpp:170
void addLabel()
Adds a graphics edge label to this edge.
Definition graphicsedge.cpp:273
void adjust()
Leaves some empty space (offset) from node - make the edge weight appear on the centre of the edge.
Definition graphicsedge.cpp:420
int targetNodeNumber()
Definition graphicsedge.cpp:371
qreal length() const
Returns the euclidean length of the edge.
Definition graphicsedge.cpp:410
void setStyle(const Qt::PenStyle &style)
Sets the PenStyle of this edge.
Definition graphicsedge.cpp:621
qreal dy() const
Returns the vertical difference between target and source nodes.
Definition graphicsedge.cpp:400
void setHighlighted(const bool &flag)
Toggles the highlighted state of the the edge, if highlighting is allowed.
Definition graphicsedge.cpp:775
GraphicsNode * sourceNode() const
Returns the source node of this graphics edge.
Definition graphicsedge.cpp:306
QString m_label
Definition graphicsedge.h:157
QPen pen() const
Returns the QPen for this edge – the pen changes when the edge state changes/.
Definition graphicsedge.cpp:639
void setWeightNumberVisibility(const bool &toggle)
Toggles visibility of weight numbers.
Definition graphicsedge.cpp:228
bool m_drawWeightNumber
Definition graphicsedge.h:166
qreal angle
Definition graphicsedge.h:164
qreal m_width
Definition graphicsedge.h:160
GraphicsNode * target
Definition graphicsedge.h:137
bool m_hoverHighlighting
Definition graphicsedge.h:167
QColor m_color
Definition graphicsedge.h:158
void addWeightNumber()
Adds a graphics edge weight to this edge.
Definition graphicsedge.cpp:213
void setLabel(const QString &label)
Changes the edge label.
Definition graphicsedge.cpp:252
qreal dx() const
Returns the horizontal difference between target and source nodes.
Definition graphicsedge.cpp:391
qreal width() const
Returns the width of the edge as a function of edge weight.
Definition graphicsedge.cpp:762
int type() const
Definition graphicsedge.h:63
void setMinimumOffsetFromNode(const int &offset)
Updates Minimum Offset From Node and calls adjust to update the edge.
Definition graphicsedge.cpp:380
@ Type
Definition graphicsedge.h:62
bool m_Bezier
Definition graphicsedge.h:166
qreal line_length
Definition graphicsedge.h:164
bool m_drawLabel
Definition graphicsedge.h:167
qreal m_weight
Definition graphicsedge.h:160
bool m_drawArrows
Definition graphicsedge.h:166
QPainterPath m_path
Definition graphicsedge.h:143
qreal weight() const
Returns the weight/value of this edge.
Definition graphicsedge.cpp:205
bool m_isClicked
Definition graphicsedge.h:168
Qt::PenStyle m_style
Definition graphicsedge.h:154
int m_state
Definition graphicsedge.h:155
qreal m_offsetFromSourceNode
Definition graphicsedge.h:152
Qt::PenStyle style() const
Returns the PenStyle of this edge.
Definition graphicsedge.cpp:630
void setWeight(const qreal &w)
Changes the edge weight - Updates both the width and the weightNumber.
Definition graphicsedge.cpp:186
qreal line_dy
Definition graphicsedge.h:164
int m_edgeDirType
Definition graphicsedge.h:162
void setTargetNodeSize(const int &size)
Called from graphicsNode to update edge offset from target node (i.e. when node size changes)
Definition graphicsedge.cpp:362
qreal line_dx
Definition graphicsedge.h:164
~GraphicsEdge()
**
Definition graphicsedge.cpp:816
GraphicsNode * source
Definition graphicsedge.h:137
void setTargetNode(GraphicsNode *node)
Sets the target node.s.
Definition graphicsedge.cpp:353
void setDirectionType(const int &dirType=0)
Changes the direction type of edge A->B.
Definition graphicsedge.cpp:590
QPointF targetPoint
Definition graphicsedge.h:145
QString m_colorNegative
Definition graphicsedge.h:157
GraphicsNode * targetNode() const
Returns the target node.
Definition graphicsedge.cpp:344
void setSourceNode(GraphicsNode *node)
Sets the source node of this graphics edge.
Definition graphicsedge.cpp:315
void setHighlighting(const bool &toggle)
Toggles edge highlighting on or off.
Definition graphicsedge.cpp:795
qreal m_minOffsetFromNode
Definition graphicsedge.h:151
void setSourceNodeSize(const int &size)
Called from graphicsNode to update edge offset from source node (i.e. when node size changes)
Definition graphicsedge.cpp:325
int directionType()
returns the direction type of this edge
Definition graphicsedge.cpp:611
int sourceNodeNumber()
Definition graphicsedge.cpp:335
Definition graphicsnode.h:47
static const int EDGE_STATE_HOVER
Definition graphicsedge.h:43
static const int TypeEdge
Definition graphicsedge.h:37
static const int EDGE_STATE_REGULAR
Definition graphicsedge.h:41
static const int ZValueEdge
Definition graphicsedge.h:38
static const int EDGE_STATE_HIGHLIGHT
Definition graphicsedge.h:42
static const int ZValueEdgeHighlighted
Definition graphicsedge.h:39