mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user