Revamp code

-Move MoveElementsCommand class from diagramcommands file to
movegraphicsitemcommand file.
-Rename the to class MoveGraphicsItemCommand.
-Minor code change to make it more modern.
This commit is contained in:
joshua
2022-11-08 22:06:50 +01:00
parent 7fede2277f
commit 9e1ef8c42f
5 changed files with 242 additions and 190 deletions

View File

@@ -69,45 +69,6 @@ class CutDiagramCommand : public DeleteQGraphicsItemCommand {
CutDiagramCommand(const CutDiagramCommand &);
};
/**
@brief The MoveElementsCommand class
This command moves some content on a particular diagram.
*/
class MoveElementsCommand : public QUndoCommand {
// constructors, destructor
public:
MoveElementsCommand(Diagram *, const DiagramContent &,
const QPointF &m, QUndoCommand * = nullptr);
~MoveElementsCommand() override;
private:
MoveElementsCommand(const MoveElementsCommand &);
// methods
public:
void undo() override;
void redo() override;
virtual void move(const QPointF &);
private:
void setupAnimation (QObject * target,
const QByteArray &propertyName,
const QVariant& start,
const QVariant& end);
// attributes
private:
/// diagram the movement takes place on.
Diagram *diagram;
/// moved content
DiagramContent content_to_move;
/// applied movement
QPointF movement;
///animation group
QParallelAnimationGroup *m_anim_group;
/// prevent the first call to redo()
bool first_redo;
};
/**
@brief The MoveConductorsTextsCommand class
This command moves text items related to conductors