Les pivotements d'elements sont desormais annulables

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@139 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavierqet
2007-09-27 15:36:15 +00:00
parent bc650ea347
commit 27e8ced638
6 changed files with 75 additions and 10 deletions

View File

@@ -327,3 +327,33 @@ void ChangeDiagramTextCommand::redo() {
text_item -> previous_text = text_after;
}
}
/**
Constructeur
@param elements Elements a pivoter associes a leur orientation d'origine
@param parent QUndoCommand parent
*/
RotateElementsCommand::RotateElementsCommand(const QHash<Element *, QET::Orientation> &elements, QUndoCommand *parent) :
QUndoCommand(QObject::tr("pivoter ") + QET::ElementsAndConducersSentence(elements.count(), 0), parent),
elements_to_rotate(elements)
{
}
/// Destructeur
RotateElementsCommand::~RotateElementsCommand() {
}
/// defait le pivotement
void RotateElementsCommand::undo() {
foreach(Element *e, elements_to_rotate.keys()) {
e -> setOrientation(elements_to_rotate[e]);
}
}
/// refait le pivotement
void RotateElementsCommand::redo() {
foreach(Element *e, elements_to_rotate.keys()) {
e -> setOrientation(e -> orientation().next());
e -> update();
}
}