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 | |
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*)
| GraphDisplayWidget::GraphDisplayWidget | ( | QWidget * | parent = nullptr | ) |
constructor (build the scene and connect signals/slots)
References updateView().
|
virtual |
destructor
| 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.
| ptr | a pointer to the object that is represented by this link. |
| from | a pointer to the object represented as a node (and added before by addNode) that this links from |
| to | a pointer to the object represented as a node (and added before by addNode) that this links to |
| tooltip | The tooltip to be displayed when the mouse hovers over the link |
| pen | The pen used to draw the line (color, brush, width...) |
| arrowHead | if true adds an arrow pointing to the to object |
| void GraphDisplayWidget::addNode | ( | const void * | ptr, |
| QString | tooltip, | ||
| QColor | color, | ||
| QColor | lineColor, | ||
| QString | internalText = "" ) |
Add a node to the graph.
| ptr | the Object referred to by the node |
| tooltip | The tooltip to be displayed when the mouse hovers over the node |
| color | The color of the disc representing the node |
| lineColor | The color of the circle around the disc |
| internalText | Text to display inside the node (can be any UTF-8 character) |
| void GraphDisplayWidget::autoScale | ( | ) |
Resize the content of the canvas to the size of the widget.
Referenced by mouseReleaseEvent(), refresh(), and resizeEvent().
| void GraphDisplayWidget::clear | ( | ) |
Empty all nodes and links.
|
signal |
link was double clicked
References mouseDoubleClickEvent(), mouseReleaseEvent(), resizeEvent(), setSelectedLink(), setSelectedNode(), and updateView().
Referenced by TransformationExplorer::getWidget(), and mouseDoubleClickEvent().
|
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().
|
overrideprotected |
process double clicked nodes and link
References linkDoubleClicked(), and nodeDoubleClicked().
Referenced by linkDoubleClicked().
|
overrideprotected |
References autoScale().
Referenced by linkDoubleClicked().
|
signal |
node was double clicked
Referenced by TransformationExplorer::getWidget(), and mouseDoubleClickEvent().
|
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().
| void GraphDisplayWidget::refresh | ( | ) |
|
overrideprotected |
make sure the scene fit the new size entirely
References autoScale(), and resizeEvent().
Referenced by linkDoubleClicked(), and resizeEvent().
| void GraphDisplayWidget::setNodeDiameter | ( | float | d | ) |
Set the diameter of nodes' graphical representation.
References refresh().
|
slot |
Specify to the view that a link was selected.
| link | a pointer to the object represented by the link |
Referenced by linkDoubleClicked(), and updateView().
|
slot |
Specify to the view that a node was selected.
| node | a pointer to the object represented by the node |
Referenced by linkDoubleClicked(), and updateView().
|
slot |
Get the selection of nodes and links from the 2D canvas.
References linkSelectionChanged(), nodeSelectionChanged(), setSelectedLink(), and setSelectedNode().
Referenced by GraphDisplayWidget(), and linkDoubleClicked().