#include <graphicswidget.h>

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

Public Slots

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

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. More...
 
 ~GraphicsWidget ()
 Destructor. Calls the method to clear the data. More...
 
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 with the edge name. More...
 
void setInitNodeSize (int)
 Sets initial node size from MW. More...
 
void setInitZoomIndex (const int &)
 Sets the initial zoom setting. Use setMaxZoomIndex() instead. More...
 
void setMaxZoomIndex (const int &)
 Sets the max zoom allowed (and the initial zoom as half of it). Called from MW on startup. More...
 
GraphicsNodehasNode (QString text)
 Checks if a node with label or nodeNum 'text' exists and returns it. More...
 
void setSelectedNodes (QList< int > list)
 Selects all nodes in the given list. More...
 
QList< QGraphicsItem * > selectedItems ()
 Returns a list of all selected QGraphicsItem(s) More...
 
QList< int > selectedNodes ()
 Returns a List of selected node numbers. More...
 
QList< SelectedEdgeselectedEdges ()
 Returns a QList of selected directed edges structs in the form of v1,v2. More...
 
void selectAll ()
 Forces the scene to select all items. Also signals that no node is clicked. More...
 
void selectNone ()
 Clears any item selection from the scene. Also signals that no node is clicked. More...
 
void removeItem (GraphicsEdge *)
 Removes an edge item from the scene. 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. 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 displaying node numbers in or out of nodes. More...
 
void setAllItemsVisibility (int, bool)
 Toggles the visibility of all items of the given type. More...
 
void removeAllItems (int)
 Removes all items of the given type. More...
 

Protected Member Functions

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

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

◆ 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: