SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
A graphics item that represents an arc as it is being constructed. More...
#include <qtPreviewArc.h>
Public Types | |
enum | ArcStatus : int { ArcStatus::Invalid, ArcStatus::Valid } |
Arcs between nodes indicate a required ordering of tasks. More... | |
using | Superclass = QGraphicsPathItem |
Public Slots | |
int | updateArcPoints () |
Recompute points specifying the shape of the arc based on the current endpoint-node positions and geometry. | |
bool | setArcType (smtk::string::Token arcType, const std::string &operationType, const std::string &destinationItemName) |
Set the arc and operation type. More... | |
Public Member Functions | |
qtPreviewArc (qtDiagramScene *scene, const std::shared_ptr< smtk::operation::Manager > &operationManager, smtk::string::Token arcType=smtk::string::Token(), const std::string &arcOperation=std::string(), const std::string &arcDestinationItemName=std::string(), QGraphicsItem *parent=nullptr) | |
qtDiagramScene * | scene () const |
smtk::string::Token | arcType () const |
std::string | arcOperation () const |
void | setPredecessor (qtBaseObjectNode *predecessor) |
Set/get the predecessor node for the arc to be created. | |
qtBaseObjectNode * | predecessor () const |
void | setSuccessor (qtBaseObjectNode *successor, bool updatePoints=true) |
Set/get the successor node for the arc to be created. More... | |
qtBaseObjectNode * | successor () const |
void | confirmPredecessorNode (bool confirm=true) |
Confirm the predecessor node. More... | |
bool | isPredecessorConfirmed () const |
Return whether the predecessor node has been confirmed (true) or not (false). | |
void | confirmSuccessorNode () |
Confirm the successor node. More... | |
Static Public Member Functions | |
static ArcStatus | arcStatusEnum (const std::string &enumerant, bool *match=nullptr) |
static std::string | arcStatusName (ArcStatus enumerant) |
Protected Member Functions | |
virtual void | createOperation () |
QRectF | boundingRect () const override |
Get the bounding box of the node, which includes the border width and the label. | |
void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override |
Draw the arc into the scene. | |
Protected Attributes | |
qtDiagramScene * | m_scene { nullptr } |
qtBaseObjectNode * | m_predecessor { nullptr } |
qtBaseObjectNode * | m_successor { nullptr } |
smtk::string::Token | m_arcType |
std::string | m_arcOperation |
std::string | m_arcDestinationItemName |
QPainterPath | m_predecessorMark |
QPainterPath | m_successorMark |
QPainterPath | m_computedPath |
QPainterPath | m_arrowPath |
bool | m_predecessorConfirmed { false } |
bool | m_canAssociatePredecessor { false } |
bool | m_canAssociateSuccessor { false } |
bool | m_ableToOperate { false } |
std::shared_ptr< smtk::operation::Manager > | m_operationManager |
std::shared_ptr< smtk::operation::Operation > | m_operation |
A graphics item that represents an arc as it is being constructed.
|
strong |
void smtk::extension::qtPreviewArc::confirmPredecessorNode | ( | bool | confirm = true | ) |
Confirm the predecessor node.
During arc construction, the predecessor node will be set repeatedly as the pointer moves over each task. When the user clicks, this method is called to indicate that the pointer should now control the successor node.
void smtk::extension::qtPreviewArc::confirmSuccessorNode | ( | ) |
Confirm the successor node.
During arc construction, once the user clicks to confirm the current successor node (underneath the pointer), this method is invoked. It launches the operation associated with the arc and resets this class in preparation to create the next arc.
Note that unlike confirmPredecessorNode(), this method does not store any status variable since once the operation is launched, the predecessor and successor are both reset. You cannot "unconfirm" a successor node – once confirmed the operation is immediately launched.
|
slot |
Set the arc and operation type.
Users may change this any time before the arc's successor node is confirmed.
This returns true when a change was made and false otherwise. Note that if operationType is non-empty and the operation cannot be created, this method will reject the change and return false.
void smtk::extension::qtPreviewArc::setSuccessor | ( | qtBaseObjectNode * | successor, |
bool | updatePoints = true |
||
) |
Set/get the successor node for the arc to be created.
You must call setPredecessor with a non-null value before calling this method.