SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Public Types | Public Slots | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
smtk::extension::qtDiagramScene Class Reference

A QGraphicsScene that holds QGraphicsItems for diagrams. More...

#include <qtDiagramScene.h>

Inheritance diagram for smtk::extension::qtDiagramScene:
[legend]
Collaboration diagram for smtk::extension::qtDiagramScene:
[legend]

Public Types

using Superclass = QGraphicsScene
 

Public Slots

bool computeLayout (const std::unordered_set< qtBaseNode * > &nodes, const std::unordered_set< qtBaseArc * > &arcs)
 Compute a layout of the nodes and arcs passed into this method. More...
 

Public Member Functions

 qtDiagramScene (qtDiagram *)
 
void setConfiguration (qtDiagramViewConfiguration *config)
 Set/get the view configuration object passed to us from the parent widget.
 
qtDiagramViewConfigurationconfiguration () const
 
qtDiagramdiagram ()
 Return the parent diagram.
 

Protected Member Functions

void drawBackground (QPainter *painter, const QRectF &rect) override
 Draw a cross-hatched grid for the background.
 

Static Protected Member Functions

static QPointF snapToGrid (const qreal &x, const qreal &y, const qreal &resolution=1.0)
 Snaps the given x and y coordinate to the next available top left grid point. More...
 

Protected Attributes

qtDiagramViewConfigurationm_config { nullptr }
 
qtDiagramm_diagram { nullptr }
 

Detailed Description

A QGraphicsScene that holds QGraphicsItems for diagrams.

Diagrams are node+arc schematic figures whose items are maintained by qtDiagramGenerator instances.

Member Function Documentation

◆ computeLayout

bool smtk::extension::qtDiagramScene::computeLayout ( const std::unordered_set< qtBaseNode * > &  nodes,
const std::unordered_set< qtBaseArc * > &  arcs 
)
slot

Compute a layout of the nodes and arcs passed into this method.

This uses graphviz to perform the layout and returns true on success.

◆ snapToGrid()

QPointF smtk::extension::qtDiagramScene::snapToGrid ( const qreal &  x,
const qreal &  y,
const qreal &  resolution = 1.0 
)
staticprotected

Snaps the given x and y coordinate to the next available top left grid point.

Optionally, the grid can be scaled with the resolution parameter.


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