Code Documentation 3.1
Social Network Visualizer
Loading...
Searching...
No Matches
GraphicsWidget Class Reference

#include <graphicswidget.h>

Inheritance diagram for GraphicsWidget:
Collaboration diagram for GraphicsWidget:

Public Slots

void handleSelectionChanged ()
 Handles the event of selection change in the scene.
 
void relationSet (int relation)
 Changes the current relation.
 
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)
 Draws a new node in the scene.
 
void removeNode (const int &nodeNum)
 Deletes the node with the given number from the scene, if exists.
 
void setNodeVisibility (const int &nodeNum, const bool &toggle)
 Changes the visibility of a Node.
 
void setNodeClicked (GraphicsNode *)
 Clears clickedEdge and emits a signal to Graph.
 
void moveNode (const int &num, const qreal &x, const qreal &y)
 Moves the node with the given number to the new coordinates.
 
bool setNodeSize (const int &nodeNumber, const int &size=0)
 Changes the size of a node.
 
void setNodeSizeAll (const int &size=0)
 Changes the size of all nodes.
 
bool setNodeShape (const int &nodeNum, const QString &shape, const QString &iconPath=QString())
 Sets the shape of an node.
 
bool setNodeColor (const int &nodeNum, const QString &color)
 Sets the color of an node.
 
void setNodeNumberColor (const int &nodeNum, const QString &color)
 Changes the color of a node number.
 
void setNodeNumberVisibility (const bool &toggle)
 Toggles the visibility of node numbers.
 
bool setNodeNumberSize (const int &nodeNum, const int &size=0)
 Changes the size of the number of a node.
 
bool setNodeNumberDistance (const int &, const int &distance=0)
 Changes the distance of the number of a node.
 
void setNodeLabelsVisibility (const bool &toggle)
 Toggles the visibility of all node labels.
 
bool setNodeLabelColor (const int &nodeNum, const QString &color="green")
 Changes the label color of a node to 'color'.
 
bool setNodeLabelSize (const int &, const int &size=0)
 Changes the label size of a node to 'size'.
 
bool setNodeLabel (const int &, const QString &label)
 Sets the label of an node.
 
bool setNodeLabelDistance (const int &, const int &distance=0)
 Changes the distance of the label of the given node.
 
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 a new edge in the scene, from node with sourceNum to node with targetNum.
 
void removeEdge (const int &source, const int &target, const bool &removeOpposite=false)
 Removes the edge from node sourceNum to node targetNum from the scene.
 
void setEdgeVisibility (const int &relation, const int &sourceNum, const int &targetNum, const bool &visible, const bool &preserveReverseEdge=false, const int &edgeWeight=1, const int &reverseEdgeWeight=1)
 Toggles the visibility of the given edge.
 
bool setEdgeDirectionType (const int &source, const int &target, const int &dirType=false)
 Changes the direction type of an existing edge.
 
bool setEdgeWeight (const int &, const int &, const qreal &)
 Sets the weight of an edge.
 
void setEdgeLabel (const int &source, const int &target, const QString &label)
 Sets the label of an edge.
 
void setEdgeColor (const int &, const int &, const QString &)
 Sets the color of an edge.
 
void setEdgeClicked (GraphicsEdge *, const bool &openMenu=false)
 Sets the clicked edge.
 
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.
 
void setEdgeArrowsVisibility (const bool &toggle)
 Toggles the visibility of all edge arrows.
 
void setEdgeWeightNumbersVisibility (const bool &toggle)
 Toggles all edge weight numbers visibility.
 
void setEdgeLabelsVisibility (const bool &toggle)
 Toggles all edge labels visibility.
 
void setEdgeHighlighting (const bool &toggle)
 Enables or disables edge highlighting.
 
void handleDoubleClickOnNode (GraphicsNode *node)
 Handles double-clicks (or middle-clicks) on the given node, creating a new edge if needed.
 
void clearGuides ()
 
void addGuideCircle (const double &x0, const double &y0, const double &radius)
 Adds a circular guideline.
 
void addGuideHLine (const double &y0)
 Adds a horizonal guideline.
 
void zoomIn (const int step=1)
 Increases the numerical zoom index of the scene by the given step.
 
void zoomOut (const int step=1)
 Decreases the numerical zoom index of the scene by the given step.
 
void rotateLeft ()
 Decreases the numerical rotation Rotates the view to the left, by a fixed angle.
 
void rotateRight ()
 Rotates the view to the right, by a fixed angle.
 
void changeMatrixScale (const int value)
 Does the actual zoom in or out while preserving current rotation.
 
void changeMatrixRotation (int angle)
 Rotates the view transformation by angle degrees clockwise, while preserving the current scale.
 
void reset ()
 Resets to default rotation, zoom and scale.
 
void setOptionsOpenGL (const bool &enabled=false)
 Toggles openGL.
 
void setOptionsAntialiasing (const bool &toggle)
 Toggles QPainter render hints for primitive edges and text antialiasing.
 
void setOptionsNoAntialiasingAutoAdjust (const bool &toggle)
 Toggles QGraphicsView's antialiasing auto-adjustment of exposed areas.
 

Signals

void userDoubleClickNewNode (const QPointF &)
 
void userMiddleClicked (const int &sourceNum, const int &targetNum, const qreal &weight=1)
 
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)
 Constructs a GraphicsWidget object.
 
 ~GraphicsWidget ()
 Destructor. Calls the method to clear the data.
 
void clear ()
 Clears the scene and all hashes, lists, var etc.
 
QString createEdgeName (const int &v1, const int &v2, const int &relation=-1)
 Creates a QString with the edge name.
 
void setInitNodeSize (int)
 Sets initial node size from MW.
 
void setInitZoomIndex (const int &)
 Sets the initial zoom setting. Use setMaxZoomIndex() instead.
 
void setMaxZoomIndex (const int &)
 Sets the max zoom allowed (and the initial zoom as half of it). Called from MW on startup.
 
GraphicsNodehasNode (QString text)
 Checks if a node with label or nodeNum 'text' exists and returns it.
 
void setSelectedNodes (QList< int > list)
 Selects all nodes in the given list.
 
QList< QGraphicsItem * > selectedItems ()
 Returns a list of all selected QGraphicsItem(s)
 
QList< int > selectedNodes ()
 Returns a List of selected node numbers.
 
QList< SelectedEdgeselectedEdges ()
 Returns a QList of selected directed edges structs in the form of v1,v2.
 
void selectAll ()
 Forces the scene to select all items. Also signals that no node is clicked.
 
void selectNone ()
 Clears any item selection from the scene. Also signals that no node is clicked.
 
void removeItem (GraphicsEdge *)
 Removes an edge item from the scene.
 
void removeItem (GraphicsEdgeWeight *edgeWeight)
 Removes an edge weight number item from the scene.
 
void removeItem (GraphicsEdgeLabel *edgeLabel)
 Removes an edge label item from the scene.
 
void removeItem (GraphicsNode *)
 Removes a node item from the scene.
 
void removeItem (GraphicsNodeNumber *)
 Removes a node number item from the scene.
 
void removeItem (GraphicsNodeLabel *)
 Removes a node label item from the scene.
 
void setNumbersInsideNodes (const bool &toggle)
 Toggles displaying node numbers in or out of nodes.
 
void setAllItemsVisibility (int, bool)
 Toggles the visibility of all items of the given type.
 
void removeAllItems (int)
 Removes all items of the given type.
 

Protected Member Functions

void wheelEvent (QWheelEvent *event)
 Handles the mouse wheel event. If CTRL is pressed, zooms in or out.
 
void mouseDoubleClickEvent (QMouseEvent *e)
 Handles user double-clicks.
 
void mousePressEvent (QMouseEvent *e)
 Handles the mouse press event.
 
void mouseReleaseEvent (QMouseEvent *e)
 Handles the mouse release events.
 
void resizeEvent (QResizeEvent *e)
 Handles the canvas resize event.
 

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 m_zoomIndexInit
 
int m_zoomIndexMax
 
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 hasDoubleClickedNode
 
bool clickedEdgeExists
 
bool m_nodeNumbersInside
 
bool m_nodeNumberVisibility
 
bool m_nodeLabelVisibility
 
bool m_edgeHighlighting
 
GraphicsNodefirstDoubleClickedNode
 
GraphicsNodesecondDoubleClickedNode
 
GraphicsNodemarkedEdgeSource
 
GraphicsNodemarkedEdgeTarget
 
GraphicsEdgeclickedEdge
 

Constructor & Destructor Documentation

◆ GraphicsWidget()

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

Constructs a GraphicsWidget object.

Parameters
sc
m_parent

◆ ~GraphicsWidget()

GraphicsWidget::~GraphicsWidget ( )

Destructor. Calls the method to clear the data.

Member Function Documentation

◆ addGuideCircle

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

Adds a circular guideline.

Parameters
x0
y0
radius

◆ addGuideHLine

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

Adds a horizonal guideline.

Parameters
y0

◆ changeMatrixRotation

void GraphicsWidget::changeMatrixRotation ( int  angle)
slot

Rotates the view transformation by angle degrees clockwise, while preserving the current scale.

Parameters
angle

◆ changeMatrixScale

void GraphicsWidget::changeMatrixScale ( const int  value)
slot

Does the actual zoom in or out while preserving current rotation.

Scales the view transformation by the given value (0..m_zoomIndexMax)

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 with the edge name.

Edge names are used in edgesHash

Parameters
v1
v2
relation
Returns

◆ drawEdge

void GraphicsWidget::drawEdge ( const int &  sourceNum,
const int &  targetNum,
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 a new edge in the scene, from node with sourceNum to node with targetNum.

Used when we do not have references to nodes but only node numbers: a) when we load a network file b) when the user clicks on the AddLink button on the MW.

Parameters
sourceNum
targetNum
weight
label
color
type
drawArrows
bezier
weightNumbers

◆ drawNode

void GraphicsWidget::drawNode ( const QPointF &  p,
const int &  nodeNum,
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

Draws a new node in the scene.

Called when we load files, or when the user presses "Add Node" button or the user double clicks on the canvas.

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

◆ handleDoubleClickOnNode

void GraphicsWidget::handleDoubleClickOnNode ( GraphicsNode node)
slot

Handles double-clicks (or middle-clicks) on the given node, creating a new edge if needed.

If it is the first double/middle-click on a node, it saves the first node as source. On a second double/middle-click on a node, it saves the second node as target and signals MW to notify activeGraph, which will create a new edge from source to target and will signal back to GW to draw the edge on the canvas.

Parameters
node

◆ handleSelectionChanged

void GraphicsWidget::handleSelectionChanged ( )
slot

Handles the event of selection change in the scene.

Emits selected nodes and edges to Graph

◆ hasNode()

GraphicsNode * GraphicsWidget::hasNode ( QString  text)

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

Parameters
text
Returns

◆ mouseDoubleClickEvent()

void GraphicsWidget::mouseDoubleClickEvent ( QMouseEvent *  e)
protected

Handles user double-clicks.

If the double-click was on empty space, it initiates the new node creation process. Otherwise, it the user double-clicks on a node, starts the new edge creation process.

Parameters
QMouseEvent

◆ mousePressEvent()

void GraphicsWidget::mousePressEvent ( QMouseEvent *  e)
protected

Handles the mouse press event.

Parameters
e

◆ mouseReleaseEvent()

void GraphicsWidget::mouseReleaseEvent ( QMouseEvent *  e)
protected

Handles the mouse release events.

Called when the 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 signals for every node in scene selectedItems

Parameters
e

◆ moveNode

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

Moves the node with the given number to the new coordinates.

Called while creating random networks.

Parameters
nodeNum
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.

Parameters
relation

◆ removeAllItems()

void GraphicsWidget::removeAllItems ( int  type)

Removes all items of the given type.

Parameters
type

◆ removeEdge

void GraphicsWidget::removeEdge ( const int &  sourceNum,
const int &  targetNum,
const bool &  removeReverse = false 
)
slot

Removes the edge from node sourceNum to node targetNum from the scene.

Called when erasing edges using vertex numbers. Also called when transforming directed edges to undirected.

Parameters
sourceNum
targetNum
removeReverse

◆ removeItem() [1/6]

void GraphicsWidget::removeItem ( GraphicsEdge edge)

Removes an edge item from the scene.

Called from GraphicsEdge::~GraphicsEdge() to remove itself from edgesHash, 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 &  nodeNum)
slot

Deletes the node with the given number from the scene, if exists.

Called from Graph

Parameters
nodeNum

◆ reset

void GraphicsWidget::reset ( )
slot

Resets to default rotation, zoom and scale.

◆ resized

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

◆ resizeEvent()

void GraphicsWidget::resizeEvent ( QResizeEvent *  e)
protected

Handles the canvas resize event.

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

Decreases the numerical rotation Rotates the view to the left, by a fixed angle.

◆ rotateRight

void GraphicsWidget::rotateRight ( )
slot

Rotates the view to the right, by a fixed angle.

◆ rotationChanged

void GraphicsWidget::rotationChanged ( const int  )
signal

◆ selectAll()

void GraphicsWidget::selectAll ( )

Forces the scene to select all items. Also signals that no node is clicked.

◆ selectedEdges()

QList< SelectedEdge > GraphicsWidget::selectedEdges ( )

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

Returns
QList<SelectedEdge>

◆ selectedItems()

QList< QGraphicsItem * > GraphicsWidget::selectedItems ( )

Returns a list of all selected QGraphicsItem(s)

Returns
QList<QGraphicsItem*>

◆ selectedNodes()

QList< int > GraphicsWidget::selectedNodes ( )

Returns a List of selected node numbers.

Returns
QList<int>

◆ selectNone()

void GraphicsWidget::selectNone ( )

Clears any item selection from the scene. Also signals that no node is clicked.

◆ setAllItemsVisibility()

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

Toggles the visibility of all items of the given type.

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

Sets the clicked edge.

Emits signal to Graph to:

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

◆ setEdgeColor

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

Sets the color of an edge.

Called 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
dirType
Returns

◆ setEdgeHighlighting

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

Enables or disables edge highlighting.

If enabled, an edge will be highlighted on mouse hover and edges connected to a node will be highlighted when the user selects that node.

Parameters
toggle

◆ setEdgeLabel

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

Sets the label of an edge.

Called 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 &  sourceNum,
const int &  targetNum,
const bool &  visible,
const bool &  preserveReverseEdge = false,
const int &  edgeWeight = 1,
const int &  reverseEdgeWeight = 1 
)
slot

Toggles the visibility of the given edge.

Parameters
relation
sourceNum
targetNum
visible
preserveReverseEdge

◆ setEdgeWeight

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

Sets the weight of an edge.

Called 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.

Parameters
size

◆ setInitZoomIndex()

void GraphicsWidget::setInitZoomIndex ( const int &  zoomIndex)

Sets the initial zoom setting. Use setMaxZoomIndex() instead.

Parameters
zoomIndex

◆ setMaxZoomIndex()

void GraphicsWidget::setMaxZoomIndex ( const int &  maxZoomIndex)

Sets the max zoom allowed (and the initial zoom as half of it). Called from MW on startup.

Parameters
zoomIndex

◆ setNodeClicked

void GraphicsWidget::setNodeClicked ( GraphicsNode node)
slot

Clears clickedEdge and emits a signal to Graph.

The signal is used to

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

Called when the user clicks or double-clicks on a node.

Parameters
node

◆ setNodeColor

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

Sets the color of an node.

Called 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.

Parameters
nodeNumber
label
Returns

◆ setNodeLabelColor

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

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

Parameters
nodeNum
color

◆ setNodeLabelDistance

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

Changes the distance of the label of the given node.

Parameters
nodeNum
distance

◆ setNodeLabelSize

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

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

Parameters
nodeNum
size

◆ setNodeLabelsVisibility

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

Toggles the visibility of all node labels.

Parameters
toggle

◆ setNodeNumberColor

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

Changes the color of a node number.

Parameters
nodeNumber
color

◆ setNodeNumberDistance

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

Changes the distance of the number of a node.

Parameters
nodeNum
distance

◆ setNodeNumberSize

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

Changes the size of the number of a node.

Parameters
nodeNum
size

◆ setNodeNumberVisibility

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

Toggles the visibility of node numbers.

Parameters
toggle

◆ setNodeShape

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

Sets the shape of an node.

Parameters
nodeNumber
shape
iconPath
Returns

◆ setNodeSize

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

Changes the size of a node.

Parameters
nodeNum
size
Returns
bool

◆ setNodeSizeAll

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

Changes the size of all nodes.

Parameters
size

◆ setNodeVisibility

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

Changes the visibility of a Node.

Parameters
nodeNum
toggle

◆ setNumbersInsideNodes()

void GraphicsWidget::setNumbersInsideNodes ( const bool &  toggle)

Toggles displaying node numbers in or out of nodes.

Parameters
numIn

◆ setOptionsAntialiasing

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

Toggles QPainter render hints 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

Toggles openGL.

Parameters
enabled

◆ setSelectedNodes()

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

Selects all nodes in the given list.

Parameters
list

◆ 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 &  sourceNum,
const int &  targetNum,
const qreal &  weight = 1 
)
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

Handles the mouse wheel event. If CTRL is pressed, zooms in or out.

Parameters
e

◆ zoomChanged

void GraphicsWidget::zoomChanged ( const int  )
signal

◆ zoomIn

void GraphicsWidget::zoomIn ( const int  step = 1)
slot

Increases the numerical zoom index of the scene by the given step.

Signals to MW to update the UI and do the rest.

Parameters
level

◆ zoomOut

void GraphicsWidget::zoomOut ( const int  step = 1)
slot

Decreases the numerical zoom index of the scene by the given step.

Signals to MW to update the UI and do the rest.

Parameters
level

Field 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

◆ firstDoubleClickedNode

GraphicsNode* GraphicsWidget::firstDoubleClickedNode
private

◆ fX

qreal GraphicsWidget::fX
private

◆ fY

qreal GraphicsWidget::fY
private

◆ hasDoubleClickedNode

bool GraphicsWidget::hasDoubleClickedNode
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

◆ m_zoomIndexInit

int GraphicsWidget::m_zoomIndexInit
private

◆ m_zoomIndexMax

int GraphicsWidget::m_zoomIndexMax
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

◆ secondDoubleClickedNode

GraphicsNode * GraphicsWidget::secondDoubleClickedNode
private

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