SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
A QGraphicsScene that holds QGraphicsItems for diagrams. More...
#include <qtDiagramScene.h>
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... | |
virtual void | alignHorizontal (const std::unordered_set< qtBaseNode * > &nodeSet, int alignment) |
These methods are called with +1, 0, or -1 from the above methods (alignLeft/HCenterRight and alignTop/VCenter/Bottom). More... | |
virtual void | alignVertical (const std::unordered_set< qtBaseNode * > &nodeSet, int alignment) |
virtual void | distributeHorizontal (const std::unordered_set< qtBaseNode * > &nodeSet, smtk::string::Token distribution) |
Call these methods with distribution set to "centers" or "gaps" to redistribute nodes horizontally or vertically. More... | |
virtual void | distributeVertical (const std::unordered_set< qtBaseNode * > &nodeSet, smtk::string::Token distribution) |
Public Member Functions | |
qtDiagramScene (qtDiagram *) | |
void | setConfiguration (qtDiagramViewConfiguration *config) |
Set/get the view configuration object passed to us from the parent widget. | |
qtDiagramViewConfiguration * | configuration () const |
qtDiagram * | diagram () |
Return the parent diagram. | |
std::unordered_set< qtBaseNode * > | nodesOfSelection () const |
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 | |
qtDiagramViewConfiguration * | m_config { nullptr } |
qtDiagram * | m_diagram { nullptr } |
A QGraphicsScene that holds QGraphicsItems for diagrams.
Diagrams are node+arc schematic figures whose items are maintained by qtDiagramGenerator instances.
|
virtualslot |
These methods are called with +1, 0, or -1 from the above methods (alignLeft/HCenterRight and alignTop/VCenter/Bottom).
Call these methods with aignment set to +1, 0, or -1 to align nodes horizontally or vertically.
When called with +1, nodes are aligned to their right-/top-most edges. When called with 0, nodes are aligned to their centers. When called with -1, nodes are aligned to their left-/bottom-most edges.
|
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.
|
virtualslot |
Call these methods with distribution set to "centers" or "gaps" to redistribute nodes horizontally or vertically.
When called with "centers", node center points are evenly distributed. When called with "gaps", the space between nodes is evenly distributed.
|
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.