HAL
hal::ActionMoveNode Class Reference

Moves a node. More...

#include <action_move_node.h>

Inheritance diagram for hal::ActionMoveNode:
Inheritance graph
Collaboration diagram for hal::ActionMoveNode:
Collaboration graph

Public Member Functions

 ActionMoveNode (u32 ctxID, const QPoint &to)
 
 ActionMoveNode (u32 ctxId=0, const GridPlacement *gridPlc=nullptr)
 
bool exec () override
 
QString tagname () const override
 
void writeToXml (QXmlStreamWriter &xmlOut) const override
 
void readFromXml (QXmlStreamReader &xmlIn) override
 
void addToHash (QCryptographicHash &cryptoHash) const override
 
- Public Member Functions inherited from hal::UserAction
virtual ~UserAction ()
 
virtual UserActionObject object () const
 
virtual void setObject (const UserActionObject &obj)
 
int compoundOrder () const
 
void setCompoundOrder (int cmpord)
 
qint64 timeStamp () const
 
QString cryptographicHash (int recordNo) const
 
UserActionundoAction () const
 
QString debugDump () const
 
void setObjectLock (bool lock)
 
void setParentObjectLock (bool lock)
 
bool hasProjectModified () const
 

Additional Inherited Members

- Protected Member Functions inherited from hal::UserAction
 UserAction ()
 
void writeParentObjectToXml (QXmlStreamWriter &xmlOut) const
 
void readParentObjectFromXml (QXmlStreamReader &xmlIn)
 
- Static Protected Member Functions inherited from hal::UserAction
static QString setToText (const QSet< u32 > &set)
 
static QSet< u32setFromText (const QString &s)
 
static QString gridToText (const QHash< hal::Node, QPoint > &grid)
 
static QHash< hal::Node, QPointgridFromText (const QString &txt)
 
- Protected Attributes inherited from hal::UserAction
UserActionObject mObject
 
UserActionObject mParentObject
 
int mCompoundOrder
 
UserActionmUndoAction
 
qint64 mTimeStamp
 
bool mObjectLock
 
bool mParentObjectLock
 
bool mProjectModified
 

Detailed Description

Moves a node.

Moves a node to another grid position in the GraphicsScene. The Context ID should be provided by passing it in the UserActionObject of type UserActionObjectType::Context.

Undo Action: ActionMoveNode

Definition at line 42 of file action_move_node.h.

Constructor & Destructor Documentation

◆ ActionMoveNode() [1/2]

hal::ActionMoveNode::ActionMoveNode ( u32  ctxID,
const QPoint to 
)

empty constructor

Parameters
ctxIdAction constructor.

The action object will be set by 'from' node

Parameters
ctxID- context
from- The initial position of the node to move
to- The destination of the node Action constructor.

The action object is the node to be moved

Parameters
ctxID- context
to- The destination of the node

Definition at line 46 of file action_move_node.cpp.

Referenced by exec().

◆ ActionMoveNode() [2/2]

hal::ActionMoveNode::ActionMoveNode ( u32  ctxId = 0,
const GridPlacement gridPlc = nullptr 
)

Action constructor.

Will move the nodes according to GridPlacement position info, no action object should be given

Parameters
ctxID- context
gridPlc- The grid placement instance to copy (if any)

Definition at line 38 of file action_move_node.cpp.

Member Function Documentation

◆ addToHash()

void hal::ActionMoveNode::addToHash ( QCryptographicHash cryptoHash) const
overridevirtual

Hook for derived classes to add parameter to cryptographic hash.

Parameters
cryptoHash- Additional hash data.

Reimplemented from hal::UserAction.

Definition at line 97 of file action_move_node.cpp.

References QCryptographicHash::addData().

◆ exec()

◆ readFromXml()

void hal::ActionMoveNode::readFromXml ( QXmlStreamReader xmlIn)
overridevirtual

Reads user interaction as well as arguments from xml macro file.

Parameters
xmlIn- The xml reader.

Reimplemented from hal::UserAction.

Definition at line 107 of file action_move_node.cpp.

References QXmlStreamReader::name(), QXmlStreamReader::readElementText(), and QXmlStreamReader::readNextStartElement().

◆ tagname()

QString hal::ActionMoveNode::tagname ( ) const
overridevirtual

The xml tagname for the action is purely virtual and needs to be implemented in derived class.

Returns
The tagname.

Implements hal::UserAction.

Definition at line 92 of file action_move_node.cpp.

References hal::ActionMoveNodeFactory::sFactory, and hal::UserActionFactory::tagname().

◆ writeToXml()

void hal::ActionMoveNode::writeToXml ( QXmlStreamWriter xmlOut) const
overridevirtual

Persist user interaction in xml macro file.

Parameters
xmlOut- The xml writer.

Reimplemented from hal::UserAction.

Definition at line 102 of file action_move_node.cpp.

References QString::arg(), QXmlStreamWriter::writeTextElement(), QPoint::x(), and QPoint::y().


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