#include <graphicsnode.h>

+ Inheritance diagram for GraphicsNode:
+ Collaboration diagram for GraphicsNode:

Public Types

enum  { Type = UserType + 1 }
 

Signals

void nodeClicked (GraphicsNode *)
 
void startEdge (GraphicsNode *)
 
void adjustOutEdge ()
 
void adjustInEdge ()
 
void removeOutEdge ()
 
void removeInEdge ()
 

Public Member Functions

 GraphicsNode (GraphicsWidget *gw, const int &num, const int &size, const QString &color, const QString &shape, const bool &showNumbers, const bool &numbersInside, const QString &numberColor, const int &numberSize, const int &numDistance, const bool &showLabels, const QString &label, const QString &labelColor, const int &labelSize, const int &labelDistance, const bool &edgeHighlighting, QPointF p)
 
 ~GraphicsNode ()
 
int type () const
 
QRectF boundingRect () const
 Returns the bounding rectangle of the node: The rectangle where all painting will take place. More...
 
QPainterPath shape () const
 Returns the shape of the node as a path (an accurate outline of the item's shape) Used by the collision algorithm in collidesWithItem() More...
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
 Does the actual painting using the QPainterPath created by the setShape() Called by GraphicsView and GraphicsNode methods in every update() More...
 
long int nodeNumber ()
 
void addInLink (GraphicsEdge *edge)
 GraphicsNode::addInLink Called from a new connected in-link to acknowloedge itself to this node. More...
 
void deleteInLink (GraphicsEdge *)
 
void addOutLink (GraphicsEdge *edge)
 
void deleteOutLink (GraphicsEdge *)
 
void setSize (const int &)
 
int size () const
 Returns the esoteric size of the node. Used by GraphicsEdge::GraphicsEdge() More...
 
void setShape (const QString)
 
QString nodeShape ()
 
void setColor (QString str)
 Changes the color of the node. More...
 
void setColor (QColor color)
 Changes the color of the node (overloaded) Also used when the user searches for a node. More...
 
QString color ()
 
void addLabel ()
 
GraphicsNodeLabellabel ()
 
void deleteLabel ()
 
void setLabelVisibility (const bool &toggle)
 
void setLabelSize (const int &size)
 
void setLabelText (QString label)
 
void setLabelColor (const QString &color)
 
QString labelText ()
 GraphicsNode::labelText. More...
 
void setLabelDistance (const int &distance)
 GraphicsNode::setLabelDistance. More...
 
void addNumber ()
 
GraphicsNodeNumbernumber ()
 
void deleteNumber ()
 
void setNumberVisibility (const bool &toggle)
 
void setNumberInside (const bool &toggle)
 
void setNumberSize (const int &size)
 GraphicsNode::setNumberSize. More...
 
void setNumberDistance (const int &distance)
 GraphicsNode::setNumberDistance. More...
 
void setNumberColor (const QString &color)
 GraphicsNode::setNumberColor. More...
 
void setEdgeHighLighting (const bool &toggle)
 

Protected Member Functions

QVariant itemChange (GraphicsItemChange change, const QVariant &value)
 GraphicsNode::itemChange Called when the node moves or becomes disabled or changes its visibility Propagates the changes to connected elements, i.e. edges, numbers, etc. Checks if the node is inside the scene. More...
 
void mousePressEvent (QGraphicsSceneMouseEvent *event)
 
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event)
 
void hoverEnterEvent (QGraphicsSceneHoverEvent *event)
 GraphicsNode::hoverEnterEvent on hover on node, it highlights all connected edges. More...
 
void hoverLeaveEvent (QGraphicsSceneHoverEvent *event)
 GraphicsNode::hoverLeaveEvent Stops the connected edges highlighting. More...
 

Private Attributes

GraphicsWidgetgraphicsWidget
 
QPainterPath m_path
 
QPointF newPos
 
QPolygonF * m_poly_t
 
int m_size
 
int m_size_orig
 
int m_state
 
int m_numSize
 
int m_labelSize
 
int m_numberDistance
 
int m_labelDistance
 
long int m_num
 
QString m_shape
 
QString m_col_str
 
QString m_numColor
 
QString m_labelText
 
QString m_labelColor
 
QColor m_col
 
QColor m_col_orig
 
bool m_hasNumber
 
bool m_hasLabel
 
bool m_hasNumberInside
 
bool m_edgeHighLighting
 
list< GraphicsEdge * > inEdgeList
 
list< GraphicsEdge * > outEdgeList
 
GraphicsNodeLabelm_label
 
GraphicsNodeNumberm_number
 

Detailed Description

This is actually a container-class. Contains the graphical objects called Nodes, which are displayed as triangles, boxes, circles, etc, on the canvas. Each node "knows" the others with which she is connected.

Member Enumeration Documentation

anonymous enum
Enumerator
Type 

Constructor & Destructor Documentation

GraphicsNode::GraphicsNode ( GraphicsWidget gw,
const int &  num,
const int &  size,
const QString &  color,
const QString &  shape,
const bool &  showNumbers,
const bool &  numbersInside,
const QString &  numberColor,
const int &  numberSize,
const int &  numDistance,
const bool &  showLabels,
const QString &  label,
const QString &  labelColor,
const int &  labelSize,
const int &  labelDistance,
const bool &  edgeHighlighting,
QPointF  p 
)
GraphicsNode::~GraphicsNode ( )

Member Function Documentation

void GraphicsNode::addInLink ( GraphicsEdge edge)

GraphicsNode::addInLink Called from a new connected in-link to acknowloedge itself to this node.

Parameters
edge
void GraphicsNode::addLabel ( )
void GraphicsNode::addNumber ( )
void GraphicsNode::addOutLink ( GraphicsEdge edge)
void GraphicsNode::adjustInEdge ( )
signal
void GraphicsNode::adjustOutEdge ( )
signal
QRectF GraphicsNode::boundingRect ( ) const

Returns the bounding rectangle of the node: The rectangle where all painting will take place.

Returns
QString GraphicsNode::color ( )
void GraphicsNode::deleteInLink ( GraphicsEdge link)
void GraphicsNode::deleteLabel ( )
void GraphicsNode::deleteNumber ( )
void GraphicsNode::deleteOutLink ( GraphicsEdge link)
void GraphicsNode::hoverEnterEvent ( QGraphicsSceneHoverEvent *  event)
protected

GraphicsNode::hoverEnterEvent on hover on node, it highlights all connected edges.

Parameters
event
void GraphicsNode::hoverLeaveEvent ( QGraphicsSceneHoverEvent *  event)
protected

GraphicsNode::hoverLeaveEvent Stops the connected edges highlighting.

Parameters
event
QVariant GraphicsNode::itemChange ( GraphicsItemChange  change,
const QVariant &  value 
)
protected

GraphicsNode::itemChange Called when the node moves or becomes disabled or changes its visibility Propagates the changes to connected elements, i.e. edges, numbers, etc. Checks if the node is inside the scene.

Parameters
change
value
Returns
GraphicsNodeLabel * GraphicsNode::label ( )
QString GraphicsNode::labelText ( )

GraphicsNode::labelText.

Returns
QString
void GraphicsNode::mousePressEvent ( QGraphicsSceneMouseEvent *  event)
protected

handles the events of a click on a node

void GraphicsNode::mouseReleaseEvent ( QGraphicsSceneMouseEvent *  event)
protected
void GraphicsNode::nodeClicked ( GraphicsNode )
signal
long int GraphicsNode::nodeNumber ( )
inline
QString GraphicsNode::nodeShape ( )
inline
GraphicsNodeNumber * GraphicsNode::number ( )
void GraphicsNode::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget 
)

Does the actual painting using the QPainterPath created by the setShape() Called by GraphicsView and GraphicsNode methods in every update()

Parameters
painter
option
void GraphicsNode::removeInEdge ( )
signal
void GraphicsNode::removeOutEdge ( )
signal
void GraphicsNode::setColor ( QString  str)

Changes the color of the node.

Parameters
colorstring
void GraphicsNode::setColor ( QColor  color)

Changes the color of the node (overloaded) Also used when the user searches for a node.

Parameters
color
void GraphicsNode::setEdgeHighLighting ( const bool &  toggle)
void GraphicsNode::setLabelColor ( const QString &  color)
void GraphicsNode::setLabelDistance ( const int &  distance)

GraphicsNode::setLabelDistance.

Parameters
distance
void GraphicsNode::setLabelSize ( const int &  size)
void GraphicsNode::setLabelText ( QString  label)
void GraphicsNode::setLabelVisibility ( const bool &  toggle)
void GraphicsNode::setNumberColor ( const QString &  color)

GraphicsNode::setNumberColor.

Parameters
color
void GraphicsNode::setNumberDistance ( const int &  distance)

GraphicsNode::setNumberDistance.

Parameters
distance
void GraphicsNode::setNumberInside ( const bool &  toggle)
void GraphicsNode::setNumberSize ( const int &  size)

GraphicsNode::setNumberSize.

Parameters
size
void GraphicsNode::setNumberVisibility ( const bool &  toggle)
void GraphicsNode::setShape ( const QString  shape)

Called every time the user needs to change the shape of an node.

void GraphicsNode::setSize ( const int &  size)

Sets the size of the node

QPainterPath GraphicsNode::shape ( ) const

Returns the shape of the node as a path (an accurate outline of the item's shape) Used by the collision algorithm in collidesWithItem()

Returns
int GraphicsNode::size ( ) const

Returns the esoteric size of the node. Used by GraphicsEdge::GraphicsEdge()

Returns
void GraphicsNode::startEdge ( GraphicsNode )
signal
int GraphicsNode::type ( ) const
inline

Member Data Documentation

GraphicsWidget* GraphicsNode::graphicsWidget
private
list<GraphicsEdge*> GraphicsNode::inEdgeList
private

Lists of elements attached to this node

QColor GraphicsNode::m_col
private
QColor GraphicsNode::m_col_orig
private
QString GraphicsNode::m_col_str
private
bool GraphicsNode::m_edgeHighLighting
private
bool GraphicsNode::m_hasLabel
private
bool GraphicsNode::m_hasNumber
private
bool GraphicsNode::m_hasNumberInside
private
GraphicsNodeLabel* GraphicsNode::m_label
private
QString GraphicsNode::m_labelColor
private
int GraphicsNode::m_labelDistance
private
int GraphicsNode::m_labelSize
private
QString GraphicsNode::m_labelText
private
long int GraphicsNode::m_num
private
GraphicsNodeNumber* GraphicsNode::m_number
private
int GraphicsNode::m_numberDistance
private
QString GraphicsNode::m_numColor
private
int GraphicsNode::m_numSize
private
QPainterPath GraphicsNode::m_path
private
QPolygonF* GraphicsNode::m_poly_t
private
QString GraphicsNode::m_shape
private
int GraphicsNode::m_size
private
int GraphicsNode::m_size_orig
private
int GraphicsNode::m_state
private
QPointF GraphicsNode::newPos
private
list<GraphicsEdge*> GraphicsNode::outEdgeList
private

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