[qet] [2263] define if conductor text item was moved by user or not by the weel orientation widget |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 2263
Author: blacksun
Date: 2013-06-13 19:42:37 +0200 (Thu, 13 Jun 2013)
Log Message:
-----------
define if conductor text item was moved by user or not by the weel orientation widget
Modified Paths:
--------------
trunk/sources/diagramcommands.cpp
trunk/sources/diagramcommands.h
Modified: trunk/sources/diagramcommands.cpp
===================================================================
--- trunk/sources/diagramcommands.cpp 2013-06-13 17:06:37 UTC (rev 2262)
+++ trunk/sources/diagramcommands.cpp 2013-06-13 17:42:37 UTC (rev 2263)
@@ -685,6 +685,9 @@
texts_to_rotate(previous_state),
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();
}
@@ -699,6 +702,7 @@
applied_rotation_angle_(applied_rotation)
{
foreach(DiagramTextItem *text, texts) {
+ if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(text)) previous_rotate_by_user_ = cti -> wasMovedByUser();
texts_to_rotate.insert(text, text -> rotationAngle());
}
defineCommandName();
@@ -715,6 +719,9 @@
*/
void RotateTextsCommand::undo() {
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]);
}
}
@@ -724,6 +731,10 @@
*/
void RotateTextsCommand::redo() {
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_);
}
}
Modified: trunk/sources/diagramcommands.h
===================================================================
--- trunk/sources/diagramcommands.h 2013-06-13 17:06:37 UTC (rev 2262)
+++ trunk/sources/diagramcommands.h 2013-06-13 17:42:37 UTC (rev 2263)
@@ -353,6 +353,7 @@
QHash<DiagramTextItem *, double> texts_to_rotate;
/// angle of rotation of all text items after the command
double applied_rotation_angle_;
+ bool previous_rotate_by_user_;
};
/**