From 6b3f027625dfe38e2331995a7a09043791d6f59f Mon Sep 17 00:00:00 2001 From: blacksun Date: Thu, 13 Jun 2013 17:42:37 +0000 Subject: [PATCH] define if conductor text item was moved by user or not by the weel orientation widget git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2263 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/diagramcommands.cpp | 11 +++++++++++ sources/diagramcommands.h | 1 + 2 files changed, 12 insertions(+) diff --git a/sources/diagramcommands.cpp b/sources/diagramcommands.cpp index acba4aaf7..19337dd73 100644 --- a/sources/diagramcommands.cpp +++ b/sources/diagramcommands.cpp @@ -685,6 +685,9 @@ RotateTextsCommand::RotateTextsCommand(const QHash &p texts_to_rotate(previous_state), applied_rotation_angle_(applied_rotation) { + foreach(DiagramTextItem *text, texts_to_rotate.keys()) { + if (ConductorTextItem *cti = qgraphicsitem_cast(text)) previous_rotate_by_user_ = cti -> wasRotateByUser(); + } defineCommandName(); } @@ -699,6 +702,7 @@ RotateTextsCommand::RotateTextsCommand(const QList &texts, do applied_rotation_angle_(applied_rotation) { foreach(DiagramTextItem *text, texts) { + if (ConductorTextItem *cti = qgraphicsitem_cast(text)) previous_rotate_by_user_ = cti -> wasMovedByUser(); texts_to_rotate.insert(text, text -> rotationAngle()); } defineCommandName(); @@ -715,6 +719,9 @@ RotateTextsCommand::~RotateTextsCommand() { */ void RotateTextsCommand::undo() { foreach(DiagramTextItem *text, texts_to_rotate.keys()) { + if (ConductorTextItem *cti = qgraphicsitem_cast(text)) { + cti -> forceRotateByUser(previous_rotate_by_user_); + } text -> setRotationAngle(texts_to_rotate[text]); } } @@ -724,6 +731,10 @@ void RotateTextsCommand::undo() { */ void RotateTextsCommand::redo() { foreach(DiagramTextItem *text, texts_to_rotate.keys()) { + if (ConductorTextItem *cti = qgraphicsitem_cast(text)) { + previous_rotate_by_user_ = cti -> wasRotateByUser(); + cti -> forceRotateByUser(true); + } text -> setRotationAngle(applied_rotation_angle_); } } diff --git a/sources/diagramcommands.h b/sources/diagramcommands.h index f9d9fa443..f889bce67 100644 --- a/sources/diagramcommands.h +++ b/sources/diagramcommands.h @@ -353,6 +353,7 @@ class RotateTextsCommand : public QUndoCommand { QHash texts_to_rotate; /// angle of rotation of all text items after the command double applied_rotation_angle_; + bool previous_rotate_by_user_; }; /**