#include <node.h>

Inheritance diagram for Node:
Collaboration diagram for Node:

Public Types

enum  { Type = UserType + 1 }
 

Signals

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

Public Member Functions

 Node (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, QPointF p)
 
 ~Node ()
 
int type () const
 
QRectF boundingRect () const
 
QPainterPath shape () const
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
 Node::paint Does the actual painting using the QPainterPath created by the setShape() Called by GraphicsView and Node methods in every update() More...
 
long int nodeNumber ()
 
void addInLink (Edge *edge)
 Node::addInLink Called from a new connected in-link to acknowloedge itself to this node. More...
 
void deleteInLink (Edge *)
 
void addOutLink (Edge *edge)
 
void deleteOutLink (Edge *)
 
void setSize (const int &)
 
int size () const
 
void setShape (const QString)
 
QString nodeShape ()
 
void setColor (QString str)
 
void setColor (QColor color)
 
QString color ()
 
void addLabel ()
 
NodeLabellabel ()
 
void deleteLabel ()
 
void setLabelVisibility (const bool &toggle)
 
void setLabelSize (const int &size)
 
void setLabelText (QString label)
 
void setLabelColor (const QString &color)
 
QString labelText ()
 Node::labelText. More...
 
void setLabelDistance (const int &distance)
 Node::setLabelDistance. More...
 
void addNumber ()
 
NodeNumbernumber ()
 
void deleteNumber ()
 
void setNumberVisibility (const bool &toggle)
 
void setNumberInside (const bool &toggle)
 
void setNumberSize (const int &size)
 Node::setNumberSize. More...
 
void setNumberDistance (const int &distance)
 Node::setNumberDistance. More...
 
void setNumberColor (const QString &color)
 Node::setNumberColor. More...
 
void toggleAntialiasing (bool)
 

Protected Member Functions

QVariant itemChange (GraphicsItemChange change, const QVariant &value)
 Node::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)
 Node::hoverEnterEvent on hover on node, it highlights all connected edges. More...
 
void hoverLeaveEvent (QGraphicsSceneHoverEvent *event)
 Node::hoverLeaveEvent Stops the connected edges highlighting. More...
 

Private Attributes

GraphicsWidgetgraphicsWidget
 
QPainterPath * m_path
 
QPointF newPos
 
QPolygonF * m_poly_t
 
int m_size
 
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
 
bool m_hasNumber
 
bool m_hasLabel
 
bool m_hasNumberInside
 
list< Edge * > inEdgeList
 
list< Edge * > outEdgeList
 
NodeLabelm_label
 
NodeNumberm_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

Node::Node ( 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,
QPointF  p 
)
Node::~Node ( )

Member Function Documentation

void Node::addInLink ( Edge edge)

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

Parameters
edge
void Node::addLabel ( )
void Node::addNumber ( )
void Node::addOutLink ( Edge edge)
void Node::adjustInEdge ( )
signal
void Node::adjustOutEdge ( )
signal
QRectF Node::boundingRect ( ) const
QString Node::color ( )
void Node::deleteInLink ( Edge link)
void Node::deleteLabel ( )
void Node::deleteNumber ( )
void Node::deleteOutLink ( Edge link)
void Node::hoverEnterEvent ( QGraphicsSceneHoverEvent *  event)
protected

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

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

Node::hoverLeaveEvent Stops the connected edges highlighting.

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

Node::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
NodeLabel * Node::label ( )
QString Node::labelText ( )

Node::labelText.

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

handles the events of a click on a node

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

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

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

Used by MW::slotChangeNodeColor

void Node::setColor ( QColor  color)

Used by MW::slotEditNodeFind()

void Node::setLabelColor ( const QString &  color)
void Node::setLabelDistance ( const int &  distance)

Node::setLabelDistance.

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

Node::setNumberColor.

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

Node::setNumberDistance.

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

Node::setNumberSize.

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

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

void Node::setSize ( const int &  size)

Sets the size of the node

QPainterPath Node::shape ( ) const
int Node::size ( ) const

Used by MainWindow::findNode() and Edge::Edge()

void Node::startEdge ( Node )
signal
void Node::toggleAntialiasing ( bool  )
int Node::type ( ) const
inline

Member Data Documentation

GraphicsWidget* Node::graphicsWidget
private
list<Edge*> Node::inEdgeList
private

Lists of elements attached to this node

QColor Node::m_col
private
QString Node::m_col_str
private
bool Node::m_hasLabel
private
bool Node::m_hasNumber
private
bool Node::m_hasNumberInside
private
NodeLabel* Node::m_label
private
QString Node::m_labelColor
private
int Node::m_labelDistance
private
int Node::m_labelSize
private
QString Node::m_labelText
private
long int Node::m_num
private
NodeNumber* Node::m_number
private
int Node::m_numberDistance
private
QString Node::m_numColor
private
int Node::m_numSize
private
QPainterPath* Node::m_path
private
QPolygonF* Node::m_poly_t
private
QString Node::m_shape
private
int Node::m_size
private
QPointF Node::newPos
private
list<Edge*> Node::outEdgeList
private

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