Computer Assisted Medical Intervention Tool Kit  version 6.0
Loading...
Searching...
No Matches
camitk::GraphDisplayWidget Class Reference

GraphDisplayWidget is used to manage a Widget to display a graph with nodes and links onto a 2D canvas. More...

#include <GraphDisplayWidget.h>

Public Slots

void setSelectedLink (const void *link)
 Specify to the view that a link was selected.
void setSelectedNode (const void *node)
 Specify to the view that a node was selected.
void updateView ()
 Get the selection of nodes and links from the 2D canvas.

Signals

void linkDoubleClicked (const void *node)
 link was double clicked
void linkSelectionChanged (const void *link)
 Signal emitted when a link was selected in the 2D canvas It sends the pointer to the object represented by the link.
void nodeDoubleClicked (const void *node)
 node was double clicked
void nodeSelectionChanged (const void *node)
 Signal emitted when a node was selected in the 2D canvas It sends the pointer to the object represented by the node.

Public Member Functions

void addLink (const void *ptr, const void *from, const void *to, QString tooltip, const QPen &pen, bool arrowHead)
 Add a link in the graph.
void addNode (const void *ptr, QString tooltip, QColor color, QColor lineColor, QString internalText="")
 Add a node to the graph.
void autoScale ()
 Resize the content of the canvas to the size of the widget.
void clear ()
 Empty all nodes and links.
 GraphDisplayWidget (QWidget *parent=nullptr)
 constructor (build the scene and connect signals/slots)
void refresh ()
 Refresh the 2D canvas display.
void setNodeDiameter (float d)
 Set the diameter of nodes' graphical representation.
virtual ~GraphDisplayWidget ()
 destructor

Protected Member Functions

void mouseDoubleClickEvent (QMouseEvent *) override
 process double clicked nodes and link
void mouseReleaseEvent (QMouseEvent *e) override
void resizeEvent (QResizeEvent *) override
 make sure the scene fit the new size entirely

Detailed Description

GraphDisplayWidget is used to manage a Widget to display a graph with nodes and links onto a 2D canvas.

It's inherits from QGraphicsView.

It is used by TransformationExplorer to display the graph of FrameOfReference and Transformation but is not aware of the object that are managed graphically (all managed using const void*)

Constructor & Destructor Documentation

◆ GraphDisplayWidget()

GraphDisplayWidget::GraphDisplayWidget ( QWidget * parent = nullptr)

constructor (build the scene and connect signals/slots)

References updateView().

◆ ~GraphDisplayWidget()

GraphDisplayWidget::~GraphDisplayWidget ( )
virtual

destructor

Member Function Documentation

◆ addLink()

void GraphDisplayWidget::addLink ( const void * ptr,
const void * from,
const void * to,
QString tooltip,
const QPen & pen,
bool arrowHead )

Add a link in the graph.

Parameters
ptra pointer to the object that is represented by this link.
froma pointer to the object represented as a node (and added before by addNode) that this links from
toa pointer to the object represented as a node (and added before by addNode) that this links to
tooltipThe tooltip to be displayed when the mouse hovers over the link
penThe pen used to draw the line (color, brush, width...)
arrowHeadif true adds an arrow pointing to the to object

◆ addNode()

void GraphDisplayWidget::addNode ( const void * ptr,
QString tooltip,
QColor color,
QColor lineColor,
QString internalText = "" )

Add a node to the graph.

Parameters
ptrthe Object referred to by the node
tooltipThe tooltip to be displayed when the mouse hovers over the node
colorThe color of the disc representing the node
lineColorThe color of the circle around the disc
internalTextText to display inside the node (can be any UTF-8 character)

◆ autoScale()

void GraphDisplayWidget::autoScale ( )

Resize the content of the canvas to the size of the widget.

Referenced by mouseReleaseEvent(), refresh(), and resizeEvent().

◆ clear()

void GraphDisplayWidget::clear ( )

Empty all nodes and links.

◆ linkDoubleClicked

void camitk::GraphDisplayWidget::linkDoubleClicked ( const void * node)
signal

◆ linkSelectionChanged

void camitk::GraphDisplayWidget::linkSelectionChanged ( const void * link)
signal

Signal emitted when a link was selected in the 2D canvas It sends the pointer to the object represented by the link.

Referenced by TransformationExplorer::getWidget(), and updateView().

◆ mouseDoubleClickEvent()

void GraphDisplayWidget::mouseDoubleClickEvent ( QMouseEvent * mouseEvent)
overrideprotected

process double clicked nodes and link

References linkDoubleClicked(), and nodeDoubleClicked().

Referenced by linkDoubleClicked().

◆ mouseReleaseEvent()

void GraphDisplayWidget::mouseReleaseEvent ( QMouseEvent * e)
overrideprotected

References autoScale().

Referenced by linkDoubleClicked().

◆ nodeDoubleClicked

void camitk::GraphDisplayWidget::nodeDoubleClicked ( const void * node)
signal

node was double clicked

Referenced by TransformationExplorer::getWidget(), and mouseDoubleClickEvent().

◆ nodeSelectionChanged

void camitk::GraphDisplayWidget::nodeSelectionChanged ( const void * node)
signal

Signal emitted when a node was selected in the 2D canvas It sends the pointer to the object represented by the node.

Referenced by TransformationExplorer::getWidget(), and updateView().

◆ refresh()

void GraphDisplayWidget::refresh ( )

Refresh the 2D canvas display.

References autoScale().

Referenced by setNodeDiameter().

◆ resizeEvent()

void GraphDisplayWidget::resizeEvent ( QResizeEvent * resizeEvent)
overrideprotected

make sure the scene fit the new size entirely

References autoScale(), and resizeEvent().

Referenced by linkDoubleClicked(), and resizeEvent().

◆ setNodeDiameter()

void GraphDisplayWidget::setNodeDiameter ( float d)

Set the diameter of nodes' graphical representation.

References refresh().

◆ setSelectedLink

void GraphDisplayWidget::setSelectedLink ( const void * link)
slot

Specify to the view that a link was selected.

Parameters
linka pointer to the object represented by the link

Referenced by linkDoubleClicked(), and updateView().

◆ setSelectedNode

void GraphDisplayWidget::setSelectedNode ( const void * node)
slot

Specify to the view that a node was selected.

Parameters
nodea pointer to the object represented by the node

Referenced by linkDoubleClicked(), and updateView().

◆ updateView

void GraphDisplayWidget::updateView ( )
slot

Get the selection of nodes and links from the 2D canvas.

References linkSelectionChanged(), nodeSelectionChanged(), setSelectedLink(), and setSelectedNode().

Referenced by GraphDisplayWidget(), and linkDoubleClicked().


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