QetShapeItem: Add Scale option with UNDO/REDO

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3078 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
abhishekm71
2014-05-25 18:33:06 +00:00
parent 92b8d4babf
commit 215e268467
4 changed files with 89 additions and 3 deletions

View File

@@ -1239,6 +1239,47 @@ void ChangeShapeStyleCommand::redo() {
/**
* @brief ChangeShapeScaleCommand::ChangeShapeScaleCommand Constructor
* @param shape
* @param scale_factor
* @param parent undocommand parent
*/
ChangeShapeScaleCommand::ChangeShapeScaleCommand(QetShapeItem *shape, double scale_factor, QUndoCommand *parent):
QUndoCommand(parent),
shape_(shape),
factor (scale_factor),
diagram(shape->diagram())
{}
/**
* @brief ChangeShapeScaleCommand::~ChangeShapeScaleCommand destructor
*/
ChangeShapeScaleCommand::~ChangeShapeScaleCommand() {}
/**
* @brief ChangeShapeScaleCommand::undo set the old size
*/
void ChangeShapeScaleCommand::undo() {
diagram -> removeItem(shape_);
shape_ -> scale(1/factor);
diagram -> addItem(shape_);
diagram -> showMe();
QUndoCommand::undo();
}
/**
* @brief ChangeShapeScaleCommand::redo set the new size
*/
void ChangeShapeScaleCommand::redo() {
diagram -> removeItem(shape_);
shape_ -> scale(factor);
diagram -> addItem(shape_);
diagram -> showMe();
QUndoCommand::redo();
}
/**
* @brief LinkElementsCommand::LinkElementsCommand
*Constructor