30 #include "../../../../core/pattern/mvc/ItemObserver.h"
31 #include "../../../../core/enum/EnumType.h"
32 #include "../../../../core/pattern/mvc/Observable.h"
33 #include "../../Scene.h"
36 #include <QGraphicsScene>
37 #include <QGraphicsItem>
62 if(m_item->scene() != scene)
65 m_scene->removeItem(m_item);
79 if(m_item->scene() == m_scene)
85 m_item->setPos(m_initialPosition);
86 m_scene->clearSelection();
93 return QObject::tr(
"%1");
98 return QObject::tr(
"%1");
100 return QObject::tr(
"%1 at (%2, %3)")
102 .arg(pos.x()).arg(pos.y());
QPointF m_initialPosition
std::string getName()
Returns name.
virtual void redo()
Reimplemented from QUndoCommand.
virtual ~AddCommand()
Destructor.
Abstract class to represent an observer. "View" part of MVC component. All classes representing the g...
virtual EnumType * getType()=0
Returns the type of component Reimplement this function in a Observable subclass to provide the model...
AddCommand(QGraphicsItem *item, QUndoCommand *parent=0)
Constructor.
virtual void undo()
Reimplemented from QUndoCommand.
virtual QString createCommandString(QGraphicsItem *item, const QPointF &pos)
virtual bool addItemStackWithoutScene(QGraphicsItem *item)
Class representing the scene. This scene is child of QGraphicsScene, part of Graphics View Framework...
virtual bool removeItemStackWithoutScene(QGraphicsItem *item)
virtual Observable * getModel()
Returns the "Model" part of the MVC.
Undo/Redo for add one components.
virtual void insertItem(ItemObserver *item)
Method that inserts a graphic object in the scene. Inverts the matrix of the object if necessary...