ellipse editor : use QPropertyUndoCommand instead of ChangePartCommand

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4067 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2015-07-23 09:57:09 +00:00
parent a00bfdf00f
commit 65d4b08c86
5 changed files with 106 additions and 161 deletions

View File

@@ -135,10 +135,16 @@ void ArcEditor::updateArcS()
{
if (m_locked) return;
m_locked = true;
QPropertyUndoCommand *undo= new QPropertyUndoCommand(part, "startAngle", part->property("startAngle"), ((start_angle -> value() * -1) + 90) * 16);
undo->setText("Modifier l'angle de depart d'un arc");
undo->enableAnimation();
elementScene()->undoStack().push(undo);
double value = ((start_angle -> value() * -1) + 90) * 16;
if (value != part->property("startAngle"))
{
QPropertyUndoCommand *undo= new QPropertyUndoCommand(part, "startAngle", part->property("startAngle"), value);
undo->setText("Modifier l'angle de depart d'un arc");
undo->enableAnimation();
elementScene()->undoStack().push(undo);
}
m_locked = false;
}
@@ -150,10 +156,16 @@ void ArcEditor::updateArcA()
{
if (m_locked) return;
m_locked = true;
QPropertyUndoCommand *undo= new QPropertyUndoCommand(part, "spanAngle", part->property("spanAngle"), angle -> value() * -16);
undo->setText("Modifier l'angle d'un arc");
undo->enableAnimation();
elementScene()->undoStack().push(undo);
double value = angle -> value() * -16;
if (value != part->property("spanAngle"))
{
QPropertyUndoCommand *undo= new QPropertyUndoCommand(part, "spanAngle", part->property("spanAngle"), value);
undo->setText("Modifier l'angle d'un arc");
undo->enableAnimation();
elementScene()->undoStack().push(undo);
}
m_locked = false;
}
@@ -167,10 +179,15 @@ void ArcEditor::updateArcRect()
m_locked = true;
QPointF point = part->mapFromScene(x->value() - h->value()/2, y->value() - v->value()/2);
QRectF rect(point, QSizeF(h->value(), v->value()));
QPropertyUndoCommand *undo= new QPropertyUndoCommand(part, "rect", part->property("rect"), rect);
undo->setText("Modifier un arc");
undo->enableAnimation();
elementScene()->undoStack().push(undo);
if (rect != part->property("rect"))
{
QPropertyUndoCommand *undo= new QPropertyUndoCommand(part, "rect", part->property("rect"), rect);
undo->setText("Modifier un arc");
undo->enableAnimation();
elementScene()->undoStack().push(undo);
}
m_locked = false;
}