mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 13:30:34 +01:00
Les modifications de points sur les polygones sont desormais annulables
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@106 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -162,3 +162,27 @@ void ChangePartCommand::undo() {
|
||||
void ChangePartCommand::redo() {
|
||||
cep -> setProperty(property, new_value);
|
||||
}
|
||||
|
||||
ChangePolygonPointsCommand::ChangePolygonPointsCommand(
|
||||
PartPolygon *p,
|
||||
const QVector<QPointF> &o_points,
|
||||
const QVector<QPointF> &n_points,
|
||||
QUndoCommand *parent
|
||||
) :
|
||||
QUndoCommand(QObject::tr("modification points polygone"), parent),
|
||||
polygon(p),
|
||||
old_points(o_points),
|
||||
new_points(n_points)
|
||||
{
|
||||
}
|
||||
|
||||
ChangePolygonPointsCommand::~ChangePolygonPointsCommand() {
|
||||
}
|
||||
|
||||
void ChangePolygonPointsCommand::undo() {
|
||||
polygon -> setPolygon(old_points);
|
||||
}
|
||||
|
||||
void ChangePolygonPointsCommand::redo() {
|
||||
polygon -> setPolygon(new_points);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef EDITOR_COMMANDS_H
|
||||
#define EDITOR_COMMANDS_H
|
||||
#include "customelementpart.h"
|
||||
#include "partpolygon.h"
|
||||
#include "elementscene.h"
|
||||
#include "qgimanager.h"
|
||||
#include <QtGui>
|
||||
@@ -109,4 +110,28 @@ class ChangePartCommand : public QUndoCommand {
|
||||
/// nouvelle valeur
|
||||
QVariant new_value;
|
||||
};
|
||||
|
||||
/**
|
||||
Cette classe represente l'action de modifier les points composants un polygone
|
||||
*/
|
||||
class ChangePolygonPointsCommand : public QUndoCommand {
|
||||
// constructeurs, destructeur
|
||||
public:
|
||||
ChangePolygonPointsCommand(PartPolygon *, const QVector<QPointF> &, const QVector<QPointF> &, QUndoCommand * = 0);
|
||||
virtual ~ChangePolygonPointsCommand();
|
||||
private:
|
||||
ChangePolygonPointsCommand(const ChangePolygonPointsCommand &);
|
||||
|
||||
// methodes
|
||||
virtual void undo();
|
||||
virtual void redo();
|
||||
|
||||
// attributs
|
||||
/// Polygone modifie
|
||||
PartPolygon *polygon;
|
||||
/// anciens points
|
||||
QVector<QPointF> old_points;
|
||||
/// nouveaux points
|
||||
QVector<QPointF> new_points;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -48,7 +48,7 @@ void PolygonEditor::updatePolygonPoints() {
|
||||
);
|
||||
return;
|
||||
}
|
||||
part -> setPolygon(points);
|
||||
undoStack().push(new ChangePolygonPointsCommand(part, part -> polygon(), points));
|
||||
}
|
||||
|
||||
void PolygonEditor::updatePolygonClosedState() {
|
||||
@@ -61,7 +61,6 @@ void PolygonEditor::updatePolygonClosedState() {
|
||||
QVariant(close_polygon.isChecked())
|
||||
)
|
||||
);
|
||||
// part -> setClosed(close_polygon.isChecked());
|
||||
}
|
||||
|
||||
void PolygonEditor::updateForm() {
|
||||
|
||||
Reference in New Issue
Block a user