#include <graphicswidget.h>

+ Inheritance diagram for GraphicsWidget:
+ Collaboration diagram for GraphicsWidget:

Public Slots

void getSelectedItems ()
 Emits selected nodes and edges to Graph and MW Called by QGraphicsScene::selectionChanged signal whenever the user makes a selection. Emits selectedNodes and selectedEdges lists to Graph::graphSelectionChanged() which then signals to MW::slotEditSelectionChanged to display counts on app window. More...
 
void relationSet (int relation)
 Changes the current relation Called from Graph::signalRelationChangedToGW(int) signal. More...
 
void drawNode (const QPointF &p, const int &num, const int &nodeSize, const QString &nodeShape, const QString &nodeIconPath, const QString &nodeColor, const QString &numberColor, const int &numberSize, const int &numberDistance, const QString &nodeLabel, const QString &labelColor, const int &labelSize, const int &labelDistance)
 Adds a new node onto the scene Called from Graph::vertexCreate method primarily when we load files It is also called in the end when the user presses "Add Node" button or the user double clicks (mouseDoubleClickEvent() calls Graph::vertexCreate) More...
 
void removeNode (const int &number)
 Deletes a node from the scene. Called from Graph. More...
 
void setNodeVisibility (const int &number, const bool &toggle)
 
void setNodeClicked (GraphicsNode *)
 Called when the user clicks or double-clicks on a node. Clears clickedEdge and emits the userClickedNode signal to Graph to. More...
 
void moveNode (const int &num, const qreal &x, const qreal &y)
 Called from activeGraph to update the coordinates of a GraphicsNode while creating random networks. More...
 
bool setNodeSize (const int &nodeNumber, const int &size=0)
 Changes the size of a node. More...
 
void setNodeSizeAll (const int &size=0)
 Changes the size of all nodes. More...
 
bool setNodeShape (const int &nodeNumber, const QString &shape, const QString &iconPath=QString())
 Sets the shape of an node. Called from MW when the user changes the shape of a node. More...
 
bool setNodeColor (const int &nodeNumber, const QString &color)
 Sets the color of an node. Called from MW when the user changes the color of a node (right-clicking). More...
 
void setNodeNumberColor (const int &nodeNumber, const QString &color)
 Changes the color of a node number. More...
 
void setNodeNumberVisibility (const bool &toggle)
 Toggles the visibility of node numbers. More...
 
bool setNodeNumberSize (const int &nodeNumber, const int &size=0)
 Changes the size of the number of a node. More...
 
bool setNodeNumberDistance (const int &, const int &distance=0)
 Changes the distance of the number of a node. More...
 
void setNodeLabelsVisibility (const bool &toggle)
 GraphicsWidget::setNodeLabelsVisibility. More...
 
bool setNodeLabelColor (const int &number, const QString &color="green")
 Changes the label color of a node to 'color'. More...
 
bool setNodeLabelSize (const int &, const int &size=0)
 Changes the label size of a node to 'size'. More...
 
bool setNodeLabel (const int &, const QString &label)
 Sets the label of an node. Called from MW. More...
 
bool setNodeLabelDistance (const int &, const int &distance=0)
 Changes the distance of a node label. More...
 
void drawEdge (const int &source, const int &target, const qreal &weight, const QString &label="", const QString &color="black", const int &type=0, const bool &drawArrows=true, const bool &bezier=false, const bool &weightNumbers=false)
 Draws an edge from source to target Node. Used when we do not have references to nodes but only nodeNumbers: a) when we load a network file b) when the user clicks on the AddLink button on the MW. More...
 
void removeEdge (const int &source, const int &target, const bool &removeOpposite=false)
 Remove an edge from the graphics widget. Called from MW/Graph when erasing edges using vertex numbers Also called when transforming directed edges to undirected. More...
 
void setEdgeVisibility (const int &relation, const int &source, const int &target, const bool &visible)
 Changes the visibility of an edge. More...
 
bool setEdgeDirectionType (const int &source, const int &target, const int &dirType=false)
 Changes the direction type of an existing edge. More...
 
bool setEdgeWeight (const int &, const int &, const qreal &)
 Sets the weight of an edge. Called from MW when the user changes the weight of an edge (right-clicking). More...
 
void setEdgeLabel (const int &source, const int &target, const QString &label)
 Sets the label of an edge. Called from MW when the user changes the label of an edge (right-clicking). More...
 
void setEdgeColor (const int &, const int &, const QString &)
 Sets the color of an edge. Called from MW when the user changes the color of an edge (right-clicking). Also called from Graph when all edge colors need to be changed. More...
 
void setEdgeClicked (GraphicsEdge *, const bool &openMenu=false)
 Called when the user clicks on an edge. Emits the userClickedEdge signal to Graph which is used to: More...
 
void setEdgeOffsetFromNode (const int &source, const int &target, const int &offset)
 Changes the offset of an edge (or all edges) from source and target nodes. More...
 
void setEdgeArrowsVisibility (const bool &toggle)
 Toggles the visibility of all edge arrows. More...
 
void setEdgeWeightNumbersVisibility (const bool &toggle)
 Toggles all edge weight numbers visibility. More...
 
void setEdgeLabelsVisibility (const bool &toggle)
 Toggles all edge labels visibility. More...
 
void setEdgeHighlighting (const bool &toggle)
 Toggles edge highlighting when hovering over a single edge or all edges connected to a node when the user hovers over that node. Called from MW. More...
 
void startEdge (GraphicsNode *node)
 Creates a new edge, when the user middle-clicks on two nodes consecutively On the first middle-click, it saves the first node (source). On the second middle-click, it saves the second node as target and emits the signal userMiddleClicked() to MW which will notify activeGraph, which in turn will signal back to drawEdge(). More...
 
void clearGuides ()
 
void addGuideCircle (const double &x0, const double &y0, const double &radius)
 
void addGuideHLine (const double &y0)
 
void zoomIn (int level=1)
 Called from MW (magnifier button and menu icon) to increase the zoom level of the scene. By default it increases zoom by 1. More...
 
void zoomOut (int level=1)
 Called from MW (magnifier button and menu icon) to decrease the zoom level of the scene. By default it decreases zoom by 1. More...
 
void rotateLeft ()
 GraphicsWidget::rotateLeft. More...
 
void rotateRight ()
 GraphicsWidget::rotateRight. More...
 
void changeMatrixScale (const int value)
 Initiated from MW zoomSlider and rotateSlider widgets. More...
 
void changeMatrixRotation (int angle)
 GraphicsWidget::changeMatrixRotation. More...
 
void reset ()
 Resets the transformation matrix to the identity matrix ( default zoom and scale ) More...
 
void setOptionsOpenGL (const bool &enabled=false)
 
void setOptionsAntialiasing (const bool &toggle)
 Toggles QPainter renderhints for primitive edges and text antialiasing. More...
 
void setOptionsNoAntialiasingAutoAdjust (const bool &toggle)
 Toggles QGraphicsView's antialiasing auto-adjustment of exposed areas. Default: false Items that render antialiased lines on the boundaries of their QGraphicsItem::boundingRect() can end up rendering parts of the line outside. To prevent rendering artifacts, QGraphicsView expands all exposed regions by 2 pixels in all directions. If you enable this flag, QGraphicsView will no longer perform these adjustments, minimizing the areas that require redrawing, which improves performance. A common side effect is that items that do draw with antialiasing can leave painting traces behind on the scene as they are moved. More...
 

Signals

void userDoubleClickNewNode (const QPointF &)
 
void userMiddleClicked (const int &, const int &)
 
void userClickOnEmptySpace (const QPointF &p)
 
void openNodeMenu ()
 
void openContextMenu (const QPointF p)
 
void userNodeMoved (const int &, const int &, const int &)
 
void userSelectedItems (const QList< int > selectedNodes, const QList< SelectedEdge > selectedEdges)
 
void userClickedNode (const int &nodeNumber, const QPointF &p)
 
void userClickedEdge (const int &source, const int &target, const bool &openMenu=false)
 
void zoomChanged (const int)
 
void rotationChanged (const int)
 
void resized (const int, const int)
 
void setCursor (Qt::CursorShape)
 

Public Member Functions

 GraphicsWidget (QGraphicsScene *m_scene, MainWindow *m_parent)
 
 ~GraphicsWidget ()
 
void clear ()
 Clears the scene and all hashes, lists, var etc. More...
 
QString createEdgeName (const int &v1, const int &v2, const int &relation=-1)
 creates a QString of the edge name - used for indexing edgesHash More...
 
void setInitNodeSize (int)
 
void setInitZoomIndex (int)
 Passes initial zoom setting Called from MW on startup. More...
 
GraphicsNodehasNode (QString text)
 Checks if a node with label or number 'text' exists and returns it. More...
 
void setNodesMarked (QList< int > list)
 Selects all nodes in list Called by Graph::signalNodesFound() More...
 
QList< QGraphicsItem * > selectedItems ()
 Returns a QList of all selected QGraphicsItem(s) More...
 
QList< int > selectedNodes ()
 Returns a QList of selected node numbers Called by GW::getSelectedItems and MW::selectedNodes. More...
 
QList< SelectedEdgeselectedEdges ()
 Returns a QList of selected directed edges structs in the form of v1,v2. More...
 
void selectAll ()
 Clears any clickedNode info and sets a selection rectangle in the scene, which signals QGraphicsScene::selectionChanged signal to update selectedNodes and selectedEdges. Called from MW. More...
 
void selectNone ()
 Clears any clickedNode info and any previous selection rect in the scene, which again signals selectionChanged() to update selectedNodes and selectedEdges to zero. Called from MW. More...
 
void removeItem (GraphicsEdge *)
 Removes an edge item from the scene. Called from GraphicsEdge::~GraphicsEdge() to remove itself from edgesHash and scene and be deleted. More...
 
void removeItem (GraphicsEdgeWeight *edgeWeight)
 Removes an edge weight number item from the scene. More...
 
void removeItem (GraphicsEdgeLabel *edgeLabel)
 Removes an edge label item from the scene. More...
 
void removeItem (GraphicsNode *)
 Removes a node item from the scene. Called from GraphicsNode::~GraphicsNode() to remove itself from nodeHash, scene and be deleted. More...
 
void removeItem (GraphicsNodeNumber *)
 Removes a node number item from the scene. More...
 
void removeItem (GraphicsNodeLabel *)
 Removes a node label item from the scene. More...
 
void setNumbersInsideNodes (const bool &toggle)
 Toggles node numbers displayed inside or out of nodes Called from MW. More...
 
void setAllItemsVisibility (int, bool)
 Changes the visibility of all items of certain type (i.e. number, label, edge, etc) More...
 
void removeAllItems (int)
 

Protected Member Functions

void wheelEvent (QWheelEvent *event)
 
void mouseDoubleClickEvent (QMouseEvent *e)
 Starts the new node creation process when the user double-clicks somewhere: Emits userDoubleClicked to Graph::vertexCreate(), which in turn calls this->drawNode() to create and displays node info on MW status bar Yes, it's a full circle! More...
 
void mousePressEvent (QMouseEvent *e)
 
void mouseReleaseEvent (QMouseEvent *e)
 Called when user releases a mouse button, after a click. First sees what was in the position where the user clicked If a node was underneath, it calls userNodeMoved() signal for every node in scene selectedItems. More...
 
void resizeEvent (QResizeEvent *e)
 Repositions guides then emits resized() signal to MW and eventually Graph which does the node repositioning maintaining proportions. More...
 

Private Attributes

H_NumToNode nodeHash
 
H_StrToEdge edgesHash
 
QList< int > m_selectedNodes
 
QList< SelectedEdgem_selectedEdges
 
int m_curRelation
 
int m_nodeSize
 
int m_currentRotationAngle
 
int m_zoomIndex
 
int markedEdgeSourceOrigSize
 
int markedEdgeTargetOrigSize
 
int m_edgeMinOffsetFromNode
 
double m_currentScaleFactor
 
qreal fX
 
qreal fY
 
qreal factor
 
QString m_nodeLabel
 
QString m_numberColor
 
QString m_labelColor
 
QString edgeName
 
bool m_isTransformationActive
 
bool secondDoubleClick
 
bool clickedEdgeExists
 
bool m_nodeNumbersInside
 
bool m_nodeNumberVisibility
 
bool m_nodeLabelVisibility
 
bool m_edgeHighlighting
 
GraphicsNodefirstNode
 
GraphicsNodesecondNode
 
GraphicsNodemarkedEdgeSource
 
GraphicsNodemarkedEdgeTarget
 
GraphicsEdgeclickedEdge
 

Constructor & Destructor Documentation

◆ GraphicsWidget()

GraphicsWidget::GraphicsWidget ( QGraphicsScene *  sc,
MainWindow m_parent 
)

Constructor method. Called when a GraphicsWidget object is created in MW

◆ ~GraphicsWidget()

GraphicsWidget::~GraphicsWidget ( )

Destructor.

Member Function Documentation

◆ addGuideCircle

void GraphicsWidget::addGuideCircle ( const double &  x0,
const double &  y0,
const double &  radius 
)
slot

◆ addGuideHLine

void GraphicsWidget::addGuideHLine ( const double &  y0)
slot

◆ changeMatrixRotation

void GraphicsWidget::changeMatrixRotation ( int  angle)
slot

◆ changeMatrixScale

void GraphicsWidget::changeMatrixScale ( const int  value)
slot

Initiated from MW zoomSlider and rotateSlider widgets.

Parameters
value

◆ clear()

void GraphicsWidget::clear ( )

Clears the scene and all hashes, lists, var etc.

◆ clearGuides

void GraphicsWidget::clearGuides ( )
slot

◆ createEdgeName()

QString GraphicsWidget::createEdgeName ( const int &  v1,
const int &  v2,
const int &  relation = -1 
)

creates a QString of the edge name - used for indexing edgesHash

Parameters
v1
v2
relation
Returns

◆ drawEdge

void GraphicsWidget::drawEdge ( const int &  source,
const int &  target,
const qreal &  weight,
const QString &  label = "",
const QString &  color = "black",
const int &  type = 0,
const bool &  drawArrows = true,
const bool &  bezier = false,
const bool &  weightNumbers = false 
)
slot

Draws an edge from source to target Node. Used when we do not have references to nodes but only nodeNumbers: a) when we load a network file b) when the user clicks on the AddLink button on the MW.

Parameters
source
target
weight
reciprocal
drawArrows
color
bezier

◆ drawNode

void GraphicsWidget::drawNode ( const QPointF &  p,
const int &  num,
const int &  nodeSize,
const QString &  nodeShape,
const QString &  nodeIconPath,
const QString &  nodeColor,
const QString &  numberColor,
const int &  numberSize,
const int &  numberDistance,
const QString &  nodeLabel,
const QString &  labelColor,
const int &  labelSize,
const int &  labelDistance 
)
slot

Adds a new node onto the scene Called from Graph::vertexCreate method primarily when we load files It is also called in the end when the user presses "Add Node" button or the user double clicks (mouseDoubleClickEvent() calls Graph::vertexCreate)

Parameters
num
nodeSize
nodeColor
numberColor
numberSize
nodeLabel
labelColor
labelSize
p
nodeShape
showLabels
numberInsideNode
showNumbers

◆ getSelectedItems

void GraphicsWidget::getSelectedItems ( )
slot

Emits selected nodes and edges to Graph and MW Called by QGraphicsScene::selectionChanged signal whenever the user makes a selection. Emits selectedNodes and selectedEdges lists to Graph::graphSelectionChanged() which then signals to MW::slotEditSelectionChanged to display counts on app window.

◆ hasNode()

GraphicsNode * GraphicsWidget::hasNode ( QString  text)

Checks if a node with label or number 'text' exists and returns it.

Parameters
text
Returns

◆ mouseDoubleClickEvent()

void GraphicsWidget::mouseDoubleClickEvent ( QMouseEvent *  e)
protected

Starts the new node creation process when the user double-clicks somewhere: Emits userDoubleClicked to Graph::vertexCreate(), which in turn calls this->drawNode() to create and displays node info on MW status bar Yes, it's a full circle!

Parameters
e

◆ mousePressEvent()

void GraphicsWidget::mousePressEvent ( QMouseEvent *  e)
protected

◆ mouseReleaseEvent()

void GraphicsWidget::mouseReleaseEvent ( QMouseEvent *  e)
protected

Called when user releases a mouse button, after a click. First sees what was in the position where the user clicked If a node was underneath, it calls userNodeMoved() signal for every node in scene selectedItems.

Parameters
e

◆ moveNode

void GraphicsWidget::moveNode ( const int &  num,
const qreal &  x,
const qreal &  y 
)
slot

Called from activeGraph to update the coordinates of a GraphicsNode while creating random networks.

Parameters
num
x
y

◆ openContextMenu

void GraphicsWidget::openContextMenu ( const QPointF  p)
signal

◆ openNodeMenu

void GraphicsWidget::openNodeMenu ( )
signal

◆ relationSet

void GraphicsWidget::relationSet ( int  relation)
slot

Changes the current relation Called from Graph::signalRelationChangedToGW(int) signal.

Parameters
relation

◆ removeAllItems()

void GraphicsWidget::removeAllItems ( int  type)

Removes all items of certain type (i.e. number, label, edge, etc)

◆ removeEdge

void GraphicsWidget::removeEdge ( const int &  source,
const int &  target,
const bool &  removeOpposite = false 
)
slot

Remove an edge from the graphics widget. Called from MW/Graph when erasing edges using vertex numbers Also called when transforming directed edges to undirected.

Parameters
sourceNode
targetNode

◆ removeItem() [1/6]

void GraphicsWidget::removeItem ( GraphicsEdge edge)

Removes an edge item from the scene. Called from GraphicsEdge::~GraphicsEdge() to remove itself from edgesHash and scene and be deleted.

Parameters
edge

◆ removeItem() [2/6]

void GraphicsWidget::removeItem ( GraphicsEdgeLabel edgeLabel)

Removes an edge label item from the scene.

Parameters
edgeLabel

◆ removeItem() [3/6]

void GraphicsWidget::removeItem ( GraphicsEdgeWeight edgeWeight)

Removes an edge weight number item from the scene.

Parameters
edgeWeight

◆ removeItem() [4/6]

void GraphicsWidget::removeItem ( GraphicsNode node)

Removes a node item from the scene. Called from GraphicsNode::~GraphicsNode() to remove itself from nodeHash, scene and be deleted.

Parameters
node

◆ removeItem() [5/6]

void GraphicsWidget::removeItem ( GraphicsNodeLabel nodeLabel)

Removes a node label item from the scene.

Parameters
nodeLabel

◆ removeItem() [6/6]

void GraphicsWidget::removeItem ( GraphicsNodeNumber nodeNumber)

Removes a node number item from the scene.

Parameters
nodeNumber

◆ removeNode

void GraphicsWidget::removeNode ( const int &  number)
slot

Deletes a node from the scene. Called from Graph.

Parameters
number

◆ reset

void GraphicsWidget::reset ( )
slot

Resets the transformation matrix to the identity matrix ( default zoom and scale )

◆ resized

void GraphicsWidget::resized ( const int  ,
const int   
)
signal

◆ resizeEvent()

void GraphicsWidget::resizeEvent ( QResizeEvent *  e)
protected

Repositions guides then emits resized() signal to MW and eventually Graph which does the node repositioning maintaining proportions.

Parameters
e

◆ rotateLeft

void GraphicsWidget::rotateLeft ( )
slot

◆ rotateRight

void GraphicsWidget::rotateRight ( )
slot

◆ rotationChanged

void GraphicsWidget::rotationChanged ( const int  )
signal

◆ selectAll()

void GraphicsWidget::selectAll ( )

Clears any clickedNode info and sets a selection rectangle in the scene, which signals QGraphicsScene::selectionChanged signal to update selectedNodes and selectedEdges. Called from MW.

◆ selectedEdges()

QList< SelectedEdge > GraphicsWidget::selectedEdges ( )

Returns a QList of selected directed edges structs in the form of v1,v2.

Returns
a QList of selected directed edges structs

◆ selectedItems()

QList< QGraphicsItem * > GraphicsWidget::selectedItems ( )

Returns a QList of all selected QGraphicsItem(s)

Returns
a QList of all selected QGraphicsItem(s)

◆ selectedNodes()

QList< int > GraphicsWidget::selectedNodes ( )

Returns a QList of selected node numbers Called by GW::getSelectedItems and MW::selectedNodes.

Returns
a QList of integers: the selected node numbers

◆ selectNone()

void GraphicsWidget::selectNone ( )

Clears any clickedNode info and any previous selection rect in the scene, which again signals selectionChanged() to update selectedNodes and selectedEdges to zero. Called from MW.

◆ setAllItemsVisibility()

void GraphicsWidget::setAllItemsVisibility ( int  type,
bool  visible 
)

Changes the visibility of all items of certain type (i.e. number, label, edge, etc)

Parameters
type
visible

◆ setCursor

void GraphicsWidget::setCursor ( Qt::CursorShape  )
signal

◆ setEdgeArrowsVisibility

void GraphicsWidget::setEdgeArrowsVisibility ( const bool &  toggle)
slot

Toggles the visibility of all edge arrows.

Parameters
toggle

◆ setEdgeClicked

void GraphicsWidget::setEdgeClicked ( GraphicsEdge edge,
const bool &  openMenu = false 
)
slot

Called when the user clicks on an edge. Emits the userClickedEdge signal to Graph which is used to:

  • display edge info on the status bar
  • notify context menus for the clicked edge.
    Parameters
    edge

◆ setEdgeColor

void GraphicsWidget::setEdgeColor ( const int &  source,
const int &  target,
const QString &  color 
)
slot

Sets the color of an edge. Called from MW when the user changes the color of an edge (right-clicking). Also called from Graph when all edge colors need to be changed.

Parameters
source
target
color

◆ setEdgeDirectionType

bool GraphicsWidget::setEdgeDirectionType ( const int &  source,
const int &  target,
const int &  dirType = false 
)
slot

Changes the direction type of an existing edge.

Parameters
source
target
directionType
Returns

◆ setEdgeHighlighting

void GraphicsWidget::setEdgeHighlighting ( const bool &  toggle)
slot

Toggles edge highlighting when hovering over a single edge or all edges connected to a node when the user hovers over that node. Called from MW.

Parameters
numIn

◆ setEdgeLabel

void GraphicsWidget::setEdgeLabel ( const int &  source,
const int &  target,
const QString &  label 
)
slot

Sets the label of an edge. Called from MW when the user changes the label of an edge (right-clicking).

Parameters
source
target
label

◆ setEdgeLabelsVisibility

void GraphicsWidget::setEdgeLabelsVisibility ( const bool &  toggle)
slot

Toggles all edge labels visibility.

Parameters
toggle

◆ setEdgeOffsetFromNode

void GraphicsWidget::setEdgeOffsetFromNode ( const int &  source,
const int &  target,
const int &  offset 
)
slot

Changes the offset of an edge (or all edges) from source and target nodes.

Parameters
source
target
offset

◆ setEdgeVisibility

void GraphicsWidget::setEdgeVisibility ( const int &  relation,
const int &  source,
const int &  target,
const bool &  visible 
)
slot

Changes the visibility of an edge.

Parameters
relation
source
target
toggle

◆ setEdgeWeight

bool GraphicsWidget::setEdgeWeight ( const int &  source,
const int &  target,
const qreal &  weight 
)
slot

Sets the weight of an edge. Called from MW when the user changes the weight of an edge (right-clicking).

Parameters
source
target
weight
Returns

◆ setEdgeWeightNumbersVisibility

void GraphicsWidget::setEdgeWeightNumbersVisibility ( const bool &  toggle)
slot

Toggles all edge weight numbers visibility.

Parameters
toggle

◆ setInitNodeSize()

void GraphicsWidget::setInitNodeSize ( int  size)

Sets initial node size from MW. It is Called from MW on startup and when user changes it.

◆ setInitZoomIndex()

void GraphicsWidget::setInitZoomIndex ( int  zoomIndex)

Passes initial zoom setting Called from MW on startup.

Parameters
zoomIndex

◆ setNodeClicked

void GraphicsWidget::setNodeClicked ( GraphicsNode node)
slot

Called when the user clicks or double-clicks on a node. Clears clickedEdge and emits the userClickedNode signal to Graph to.

  • display node info on the status bar
  • notify context menus for the clicked node.
    Parameters
    node

◆ setNodeColor

bool GraphicsWidget::setNodeColor ( const int &  nodeNumber,
const QString &  color 
)
slot

Sets the color of an node. Called from MW when the user changes the color of a node (right-clicking).

Parameters
nodeNumber
color
Returns

◆ setNodeLabel

bool GraphicsWidget::setNodeLabel ( const int &  nodeNumber,
const QString &  label 
)
slot

Sets the label of an node. Called from MW.

Parameters
nodeNumber
label
Returns

◆ setNodeLabelColor

bool GraphicsWidget::setNodeLabelColor ( const int &  number,
const QString &  color = "green" 
)
slot

Changes the label color of a node to 'color'.

Parameters
number
color

◆ setNodeLabelDistance

bool GraphicsWidget::setNodeLabelDistance ( const int &  number,
const int &  distance = 0 
)
slot

Changes the distance of a node label.

Parameters
number
distance

◆ setNodeLabelSize

bool GraphicsWidget::setNodeLabelSize ( const int &  number,
const int &  size = 0 
)
slot

Changes the label size of a node to 'size'.

Parameters
number
size

◆ setNodeLabelsVisibility

void GraphicsWidget::setNodeLabelsVisibility ( const bool &  toggle)
slot

◆ setNodeNumberColor

void GraphicsWidget::setNodeNumberColor ( const int &  nodeNumber,
const QString &  color 
)
slot

Changes the color of a node number.

Parameters
nodeNumber
color

◆ setNodeNumberDistance

bool GraphicsWidget::setNodeNumberDistance ( const int &  number,
const int &  distance = 0 
)
slot

Changes the distance of the number of a node.

Parameters
number
distance

◆ setNodeNumberSize

bool GraphicsWidget::setNodeNumberSize ( const int &  nodeNumber,
const int &  size = 0 
)
slot

Changes the size of the number of a node.

Parameters
number
size

◆ setNodeNumberVisibility

void GraphicsWidget::setNodeNumberVisibility ( const bool &  toggle)
slot

Toggles the visibility of node numbers.

Parameters
toggle

◆ setNodeShape

bool GraphicsWidget::setNodeShape ( const int &  nodeNumber,
const QString &  shape,
const QString &  iconPath = QString() 
)
slot

Sets the shape of an node. Called from MW when the user changes the shape of a node.

Parameters
nodeNumber
shape
Returns

◆ setNodeSize

bool GraphicsWidget::setNodeSize ( const int &  number,
const int &  size = 0 
)
slot

Changes the size of a node.

Parameters
number
size
Returns

◆ setNodeSizeAll

void GraphicsWidget::setNodeSizeAll ( const int &  size = 0)
slot

Changes the size of all nodes.

Parameters
size
Returns

◆ setNodesMarked()

void GraphicsWidget::setNodesMarked ( QList< int >  list)

Selects all nodes in list Called by Graph::signalNodesFound()

Parameters
list

◆ setNodeVisibility

void GraphicsWidget::setNodeVisibility ( const int &  number,
const bool &  toggle 
)
slot

Changes the visibility of a Node

◆ setNumbersInsideNodes()

void GraphicsWidget::setNumbersInsideNodes ( const bool &  toggle)

Toggles node numbers displayed inside or out of nodes Called from MW.

Parameters
numIn

◆ setOptionsAntialiasing

void GraphicsWidget::setOptionsAntialiasing ( const bool &  toggle)
slot

Toggles QPainter renderhints for primitive edges and text antialiasing.

Parameters
toggle

◆ setOptionsNoAntialiasingAutoAdjust

void GraphicsWidget::setOptionsNoAntialiasingAutoAdjust ( const bool &  toggle)
slot

Toggles QGraphicsView's antialiasing auto-adjustment of exposed areas. Default: false Items that render antialiased lines on the boundaries of their QGraphicsItem::boundingRect() can end up rendering parts of the line outside. To prevent rendering artifacts, QGraphicsView expands all exposed regions by 2 pixels in all directions. If you enable this flag, QGraphicsView will no longer perform these adjustments, minimizing the areas that require redrawing, which improves performance. A common side effect is that items that do draw with antialiasing can leave painting traces behind on the scene as they are moved.

Parameters
toggle

◆ setOptionsOpenGL

void GraphicsWidget::setOptionsOpenGL ( const bool &  enabled = false)
slot

◆ startEdge

void GraphicsWidget::startEdge ( GraphicsNode node)
slot

Creates a new edge, when the user middle-clicks on two nodes consecutively On the first middle-click, it saves the first node (source). On the second middle-click, it saves the second node as target and emits the signal userMiddleClicked() to MW which will notify activeGraph, which in turn will signal back to drawEdge().

Parameters
node

◆ userClickedEdge

void GraphicsWidget::userClickedEdge ( const int &  source,
const int &  target,
const bool &  openMenu = false 
)
signal

◆ userClickedNode

void GraphicsWidget::userClickedNode ( const int &  nodeNumber,
const QPointF &  p 
)
signal

◆ userClickOnEmptySpace

void GraphicsWidget::userClickOnEmptySpace ( const QPointF &  p)
signal

◆ userDoubleClickNewNode

void GraphicsWidget::userDoubleClickNewNode ( const QPointF &  )
signal

◆ userMiddleClicked

void GraphicsWidget::userMiddleClicked ( const int &  ,
const int &   
)
signal

◆ userNodeMoved

void GraphicsWidget::userNodeMoved ( const int &  ,
const int &  ,
const int &   
)
signal

◆ userSelectedItems

void GraphicsWidget::userSelectedItems ( const QList< int >  selectedNodes,
const QList< SelectedEdge selectedEdges 
)
signal

◆ wheelEvent()

void GraphicsWidget::wheelEvent ( QWheelEvent *  e)
protected

Calls the scaleView() when the user spins the mouse wheel It passes delta as new m_scale

◆ zoomChanged

void GraphicsWidget::zoomChanged ( const int  )
signal

◆ zoomIn

void GraphicsWidget::zoomIn ( int  level = 1)
slot

Called from MW (magnifier button and menu icon) to increase the zoom level of the scene. By default it increases zoom by 1.

Parameters
level

◆ zoomOut

void GraphicsWidget::zoomOut ( int  level = 1)
slot

Called from MW (magnifier button and menu icon) to decrease the zoom level of the scene. By default it decreases zoom by 1.

Parameters
level

Member Data Documentation

◆ clickedEdge

GraphicsEdge* GraphicsWidget::clickedEdge
private

◆ clickedEdgeExists

bool GraphicsWidget::clickedEdgeExists
private

◆ edgeName

QString GraphicsWidget::edgeName
private

◆ edgesHash

H_StrToEdge GraphicsWidget::edgesHash
private

◆ factor

qreal GraphicsWidget::factor
private

◆ firstNode

GraphicsNode* GraphicsWidget::firstNode
private

◆ fX

qreal GraphicsWidget::fX
private

◆ fY

qreal GraphicsWidget::fY
private

◆ m_curRelation

int GraphicsWidget::m_curRelation
private

◆ m_currentRotationAngle

int GraphicsWidget::m_currentRotationAngle
private

◆ m_currentScaleFactor

double GraphicsWidget::m_currentScaleFactor
private

◆ m_edgeHighlighting

bool GraphicsWidget::m_edgeHighlighting
private

◆ m_edgeMinOffsetFromNode

int GraphicsWidget::m_edgeMinOffsetFromNode
private

◆ m_isTransformationActive

bool GraphicsWidget::m_isTransformationActive
private

◆ m_labelColor

QString GraphicsWidget::m_labelColor
private

◆ m_nodeLabel

QString GraphicsWidget::m_nodeLabel
private

◆ m_nodeLabelVisibility

bool GraphicsWidget::m_nodeLabelVisibility
private

◆ m_nodeNumbersInside

bool GraphicsWidget::m_nodeNumbersInside
private

◆ m_nodeNumberVisibility

bool GraphicsWidget::m_nodeNumberVisibility
private

◆ m_nodeSize

int GraphicsWidget::m_nodeSize
private

◆ m_numberColor

QString GraphicsWidget::m_numberColor
private

◆ m_selectedEdges

QList<SelectedEdge> GraphicsWidget::m_selectedEdges
private

◆ m_selectedNodes

QList<int> GraphicsWidget::m_selectedNodes
private

◆ m_zoomIndex

int GraphicsWidget::m_zoomIndex
private

◆ markedEdgeSource

GraphicsNode* GraphicsWidget::markedEdgeSource
private

◆ markedEdgeSourceOrigSize

int GraphicsWidget::markedEdgeSourceOrigSize
private

◆ markedEdgeTarget

GraphicsNode* GraphicsWidget::markedEdgeTarget
private

◆ markedEdgeTargetOrigSize

int GraphicsWidget::markedEdgeTargetOrigSize
private

◆ nodeHash

H_NumToNode GraphicsWidget::nodeHash
private

◆ secondDoubleClick

bool GraphicsWidget::secondDoubleClick
private

◆ secondNode

GraphicsNode * GraphicsWidget::secondNode
private

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