mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
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:
@@ -685,6 +685,9 @@ RotateTextsCommand::RotateTextsCommand(const QHash<DiagramTextItem *, double> &p
|
||||
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 @@ RotateTextsCommand::RotateTextsCommand(const QList<DiagramTextItem *> &texts, do
|
||||
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 @@ RotateTextsCommand::~RotateTextsCommand() {
|
||||
*/
|
||||
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::undo() {
|
||||
*/
|
||||
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_);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,6 +353,7 @@ class RotateTextsCommand : public QUndoCommand {
|
||||
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_;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user