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
This commit is contained in:
blacksun
2013-06-13 17:42:37 +00:00
parent 5d06054d1a
commit 6b3f027625
2 changed files with 12 additions and 0 deletions

View File

@@ -685,6 +685,9 @@ RotateTextsCommand::RotateTextsCommand(const QHash<DiagramTextItem *, double> &p
texts_to_rotate(previous_state), texts_to_rotate(previous_state),
applied_rotation_angle_(applied_rotation) applied_rotation_angle_(applied_rotation)
{ {
foreach(DiagramTextItem *text, texts_to_rotate.keys()) {
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(text)) previous_rotate_by_user_ = cti -> wasRotateByUser();
}
defineCommandName(); defineCommandName();
} }
@@ -699,6 +702,7 @@ RotateTextsCommand::RotateTextsCommand(const QList<DiagramTextItem *> &texts, do
applied_rotation_angle_(applied_rotation) applied_rotation_angle_(applied_rotation)
{ {
foreach(DiagramTextItem *text, texts) { foreach(DiagramTextItem *text, texts) {
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(text)) previous_rotate_by_user_ = cti -> wasMovedByUser();
texts_to_rotate.insert(text, text -> rotationAngle()); texts_to_rotate.insert(text, text -> rotationAngle());
} }
defineCommandName(); defineCommandName();
@@ -715,6 +719,9 @@ RotateTextsCommand::~RotateTextsCommand() {
*/ */
void RotateTextsCommand::undo() { void RotateTextsCommand::undo() {
foreach(DiagramTextItem *text, texts_to_rotate.keys()) { foreach(DiagramTextItem *text, texts_to_rotate.keys()) {
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(text)) {
cti -> forceRotateByUser(previous_rotate_by_user_);
}
text -> setRotationAngle(texts_to_rotate[text]); text -> setRotationAngle(texts_to_rotate[text]);
} }
} }
@@ -724,6 +731,10 @@ void RotateTextsCommand::undo() {
*/ */
void RotateTextsCommand::redo() { void RotateTextsCommand::redo() {
foreach(DiagramTextItem *text, texts_to_rotate.keys()) { foreach(DiagramTextItem *text, texts_to_rotate.keys()) {
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(text)) {
previous_rotate_by_user_ = cti -> wasRotateByUser();
cti -> forceRotateByUser(true);
}
text -> setRotationAngle(applied_rotation_angle_); text -> setRotationAngle(applied_rotation_angle_);
} }
} }

View File

@@ -353,6 +353,7 @@ class RotateTextsCommand : public QUndoCommand {
QHash<DiagramTextItem *, double> texts_to_rotate; QHash<DiagramTextItem *, double> texts_to_rotate;
/// angle of rotation of all text items after the command /// angle of rotation of all text items after the command
double applied_rotation_angle_; double applied_rotation_angle_;
bool previous_rotate_by_user_;
}; };
/** /**