#include <graphicsedge.h>

+ Inheritance diagram for GraphicsEdge:
+ Collaboration diagram for GraphicsEdge:

Public Types

enum  { Type = UserType + 2 }
 

Public Slots

void adjust ()
 Leaves some empty space (offset) from node - make the edge weight appear on the centre of the edge. More...
 

Public Member Functions

 GraphicsEdge (GraphicsWidget *, GraphicsNode *, GraphicsNode *, const qreal &weight, const QString &label, const QString &color, const Qt::PenStyle &style, const int &type, const bool &drawArrows, const bool &bezier, const bool &weightNumbers=false, const bool &highlighting=true)
 
 ~GraphicsEdge ()
 ‍** More...
 
int type () const
 
GraphicsNodesourceNode () const
 
void setSourceNode (GraphicsNode *node)
 
GraphicsNodetargetNode () const
 
void setTargetNode (GraphicsNode *node)
 
int sourceNodeNumber ()
 
int targetNodeNumber ()
 
qreal dx () const
 
qreal dy () const
 
qreal length () const
 
void setSourceNodeSize (const int &size)
 Called from graphicsNode to update edge offset from source node (i.e. when node size changes) More...
 
void setTargetNodeSize (const int &size)
 Called from graphicsNode to update edge offset from target node (i.e. when node size changes) More...
 
void setMinimumOffsetFromNode (const int &offset)
 Updates Minimum Offset From Node and calls adjust to update the edge. More...
 
void removeRefs ()
 
void setWeight (const qreal &w)
 Called from MW when user wants to change an edge's weight. Updates both the width and the weightNumber. More...
 
qreal weight () const
 Returns the weight/value of this edge. More...
 
void addWeightNumber ()
 
void setWeightNumberVisibility (const bool &toggle)
 Toggles visibility of weight numbers. More...
 
void setLabel (const QString &label)
 Called from MW when user wants to change an edge's label. More...
 
QString label () const
 
void addLabel ()
 
void setLabelVisibility (const bool &toggle)
 
void showArrows (const bool &)
 
void setDirectionType (const int &dirType=0)
 Changes the direction type of edge A -> B. More...
 
int directionType ()
 returns the direction type of this edge More...
 
qreal width () const
 Returns the width of the edge as a function of edge weight. More...
 
QPen pen () const
 GraphicsEdge::pen. More...
 
void setState (const int &state)
 GraphicsEdge::setState. More...
 
void setStyle (const Qt::PenStyle &style)
 
Qt::PenStyle style () const
 
void setColor (const QString &str)
 
QColor color () const
 
QString colorToPajek ()
 Called from Graph::graphSaveToPajekFormat() More...
 
void setHighlighted (const bool &flag)
 Called from GraphicsNode to change the edge state and highlight it. This is done, when the user hovers over the node. More...
 
void setHighlighting (const bool &toggle)
 Toggles edge highlighting on or off. More...
 
QPainterPath shape () const
 Returns the shape of this edge as a QPainterPath in local coordinates. The shape is used for many things, including collision detection, hit tests, and for the QGraphicsScene::items() functions. The default implementation calls boundingRect() to return a simple rectangular shape, but we reimplement it to return a more accurate shape for non-rectangular items. More...
 

Protected Member Functions

QRectF boundingRect () const
 Defines the outer bounds of the edge as a rectangle; All painting will be restricted to inside the edge's bounding rect. Qt uses this bounding rect to determine whether the edge requires redrawing. More...
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
 GraphicsEdge::paint. More...
 
QVariant itemChange (GraphicsItemChange change, const QVariant &value)
 Called when the edge changes, i.e. moves, becomes disabled or changes its visibility. More...
 

Private Attributes

GraphicsWidgetgraphicsWidget
 
GraphicsNodesource
 
GraphicsNodetarget
 
GraphicsEdgeWeightweightNumber
 
GraphicsEdgeLabeledgeLabel
 
QPainterPath m_path
 
QPointF sourcePoint
 
QPointF targetPoint
 
QPointF edgeOffset
 
qreal m_arrowSize
 
qreal m_minOffsetFromNode
 
qreal m_offsetFromTargetNode
 
qreal m_offsetFromSourceNode
 
Qt::PenStyle m_style
 
int m_state
 
QString m_colorNegative
 
QString m_label
 
QColor m_color
 
qreal m_weight
 
qreal m_width
 
int m_edgeDirType
 
qreal angle
 
qreal line_length
 
qreal line_dx
 
qreal line_dy
 
bool m_Bezier
 
bool m_drawArrows
 
bool m_drawWeightNumber
 
bool m_drawLabel
 
bool m_hoverHighlighting
 
bool m_isClicked
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Type 

Constructor & Destructor Documentation

◆ GraphicsEdge()

SOCNETV_USE_NAMESPACE GraphicsEdge::GraphicsEdge ( GraphicsWidget gw,
GraphicsNode from,
GraphicsNode to,
const qreal &  weight,
const QString &  label,
const QString &  color,
const Qt::PenStyle &  style,
const int &  type,
const bool &  drawArrows,
const bool &  bezier,
const bool &  weightNumbers = false,
const bool &  highlighting = true 
)

◆ ~GraphicsEdge()

GraphicsEdge::~GraphicsEdge ( )

‍**

Member Function Documentation

◆ addLabel()

void GraphicsEdge::addLabel ( )

◆ addWeightNumber()

void GraphicsEdge::addWeightNumber ( )

◆ adjust

void GraphicsEdge::adjust ( )
slot

Leaves some empty space (offset) from node - make the edge weight appear on the centre of the edge.

◆ boundingRect()

QRectF GraphicsEdge::boundingRect ( ) const
protected

Defines the outer bounds of the edge as a rectangle; All painting will be restricted to inside the edge's bounding rect. Qt uses this bounding rect to determine whether the edge requires redrawing.

Returns

◆ color()

QColor GraphicsEdge::color ( ) const

◆ colorToPajek()

QString GraphicsEdge::colorToPajek ( )

Called from Graph::graphSaveToPajekFormat()

Returns

◆ directionType()

int GraphicsEdge::directionType ( )

returns the direction type of this edge

Returns

◆ dx()

qreal GraphicsEdge::dx ( ) const

◆ dy()

qreal GraphicsEdge::dy ( ) const

◆ itemChange()

QVariant GraphicsEdge::itemChange ( GraphicsItemChange  change,
const QVariant &  value 
)
protected

Called when the edge changes, i.e. moves, becomes disabled or changes its visibility.

Parameters
change
value
Returns

◆ label()

QString GraphicsEdge::label ( ) const

◆ length()

qreal GraphicsEdge::length ( ) const

◆ paint()

void GraphicsEdge::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget 
)
protected

GraphicsEdge::paint.

Parameters
painter
option

◆ pen()

QPen GraphicsEdge::pen ( ) const

◆ removeRefs()

void GraphicsEdge::removeRefs ( )

◆ setColor()

void GraphicsEdge::setColor ( const QString &  str)

◆ setDirectionType()

void GraphicsEdge::setDirectionType ( const int &  dirType = 0)

Changes the direction type of edge A -> B.

◆ setHighlighted()

void GraphicsEdge::setHighlighted ( const bool &  flag)

Called from GraphicsNode to change the edge state and highlight it. This is done, when the user hovers over the node.

Parameters
flag

◆ setHighlighting()

void GraphicsEdge::setHighlighting ( const bool &  toggle)

Toggles edge highlighting on or off.

Parameters
toggle

◆ setLabel()

void GraphicsEdge::setLabel ( const QString &  label)

Called from MW when user wants to change an edge's label.

Parameters
label

◆ setLabelVisibility()

void GraphicsEdge::setLabelVisibility ( const bool &  toggle)

◆ setMinimumOffsetFromNode()

void GraphicsEdge::setMinimumOffsetFromNode ( const int &  offset)

Updates Minimum Offset From Node and calls adjust to update the edge.

Parameters
offset

◆ setSourceNode()

void GraphicsEdge::setSourceNode ( GraphicsNode node)

◆ setSourceNodeSize()

void GraphicsEdge::setSourceNodeSize ( const int &  size)

Called from graphicsNode to update edge offset from source node (i.e. when node size changes)

Parameters
offset

◆ setState()

void GraphicsEdge::setState ( const int &  state)

GraphicsEdge::setState.

Parameters
state

◆ setStyle()

void GraphicsEdge::setStyle ( const Qt::PenStyle &  style)

◆ setTargetNode()

void GraphicsEdge::setTargetNode ( GraphicsNode node)

◆ setTargetNodeSize()

void GraphicsEdge::setTargetNodeSize ( const int &  size)

Called from graphicsNode to update edge offset from target node (i.e. when node size changes)

Parameters
offset

◆ setWeight()

void GraphicsEdge::setWeight ( const qreal &  w)

Called from MW when user wants to change an edge's weight. Updates both the width and the weightNumber.

Parameters
w

◆ setWeightNumberVisibility()

void GraphicsEdge::setWeightNumberVisibility ( const bool &  toggle)

Toggles visibility of weight numbers.

Parameters
toggle

◆ shape()

QPainterPath GraphicsEdge::shape ( ) const

Returns the shape of this edge as a QPainterPath in local coordinates. The shape is used for many things, including collision detection, hit tests, and for the QGraphicsScene::items() functions. The default implementation calls boundingRect() to return a simple rectangular shape, but we reimplement it to return a more accurate shape for non-rectangular items.

Returns
QPainterPath

◆ showArrows()

void GraphicsEdge::showArrows ( const bool &  drawArrows)

◆ sourceNode()

GraphicsNode * GraphicsEdge::sourceNode ( ) const

◆ sourceNodeNumber()

int GraphicsEdge::sourceNodeNumber ( )

Returns the source node number

Returns
int

◆ style()

Qt::PenStyle GraphicsEdge::style ( ) const

◆ targetNode()

GraphicsNode * GraphicsEdge::targetNode ( ) const

◆ targetNodeNumber()

int GraphicsEdge::targetNodeNumber ( )

Returns the target node number

Returns
int

◆ type()

int GraphicsEdge::type ( ) const
inline

◆ weight()

qreal GraphicsEdge::weight ( ) const

Returns the weight/value of this edge.

Returns

◆ width()

qreal GraphicsEdge::width ( ) const

Returns the width of the edge as a function of edge weight.

Returns

Member Data Documentation

◆ angle

qreal GraphicsEdge::angle
private

◆ edgeLabel

GraphicsEdgeLabel* GraphicsEdge::edgeLabel
private

◆ edgeOffset

QPointF GraphicsEdge::edgeOffset
private

◆ graphicsWidget

GraphicsWidget* GraphicsEdge::graphicsWidget
private

◆ line_dx

qreal GraphicsEdge::line_dx
private

◆ line_dy

qreal GraphicsEdge::line_dy
private

◆ line_length

qreal GraphicsEdge::line_length
private

◆ m_arrowSize

qreal GraphicsEdge::m_arrowSize
private

◆ m_Bezier

bool GraphicsEdge::m_Bezier
private

◆ m_color

QColor GraphicsEdge::m_color
private

◆ m_colorNegative

QString GraphicsEdge::m_colorNegative
private

◆ m_drawArrows

bool GraphicsEdge::m_drawArrows
private

◆ m_drawLabel

bool GraphicsEdge::m_drawLabel
private

◆ m_drawWeightNumber

bool GraphicsEdge::m_drawWeightNumber
private

◆ m_edgeDirType

int GraphicsEdge::m_edgeDirType
private

◆ m_hoverHighlighting

bool GraphicsEdge::m_hoverHighlighting
private

◆ m_isClicked

bool GraphicsEdge::m_isClicked
private

◆ m_label

QString GraphicsEdge::m_label
private

◆ m_minOffsetFromNode

qreal GraphicsEdge::m_minOffsetFromNode
private

◆ m_offsetFromSourceNode

qreal GraphicsEdge::m_offsetFromSourceNode
private

◆ m_offsetFromTargetNode

qreal GraphicsEdge::m_offsetFromTargetNode
private

◆ m_path

QPainterPath GraphicsEdge::m_path
private

◆ m_state

int GraphicsEdge::m_state
private

◆ m_style

Qt::PenStyle GraphicsEdge::m_style
private

◆ m_weight

qreal GraphicsEdge::m_weight
private

◆ m_width

qreal GraphicsEdge::m_width
private

◆ source

GraphicsNode* GraphicsEdge::source
private

◆ sourcePoint

QPointF GraphicsEdge::sourcePoint
private

◆ target

GraphicsNode * GraphicsEdge::target
private

◆ targetPoint

QPointF GraphicsEdge::targetPoint
private

◆ weightNumber

GraphicsEdgeWeight* GraphicsEdge::weightNumber
private

The documentation for this class was generated from the following files: