Use QPropertyUndoCommand instead of ChangeSeveralConductorsPropertiesCommand and ChangeConductorsPropertiesCommand.

Remove class ChangeSeveralConductorsPropertiesCommand and ChangeConductorsPropertiesCommand.


git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4092 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2015-08-09 12:06:31 +00:00
parent c801c3e0a5
commit ed75c57c1d
10 changed files with 87 additions and 288 deletions

View File

@@ -27,6 +27,8 @@
#include "terminal.h"
#include "conductorautonumerotation.h"
#include "conductorpropertiesdialog.h"
#include "QPropertyUndoCommand/qpropertyundocommand.h"
#define PR(x) qDebug() << #x " = " << x;
bool Conductor::pen_and_brush_initialized = false;
@@ -1371,6 +1373,7 @@ void Conductor::readProperties() {
text_item -> setVisible(properties_.m_show_text);
}
calculateTextItemPosition();
update();
}
/**
@@ -1415,14 +1418,15 @@ void Conductor::displayedTextChanged() {
if (qmbreturn == 0 || qmbreturn == QMessageBox::No)
{
// initialise l'objet UndoCommand correspondant
QVariant old_value, new_value;
old_value.setValue(properties_);
ConductorProperties new_properties(properties_);
new_properties.text = text_item -> toPlainText();
new_value.setValue(new_properties);
ChangeConductorPropertiesCommand *ccpc = new ChangeConductorPropertiesCommand(this);
ccpc -> setOldSettings(properties_);
ccpc -> setNewSettings(new_properties);
my_diagram -> undoStack().push(ccpc);
QPropertyUndoCommand *undo = new QPropertyUndoCommand(this, "properties", old_value, new_value);
undo->setText(tr("Modifier les propriétés d'un conducteur", "undo caption"));
my_diagram -> undoStack().push(undo);
}
}
}

View File

@@ -19,6 +19,7 @@
#define CONDUCTOR_H
#include "conductorproperties.h"
#include <QGraphicsPathItem>
class ConductorProfile;
class ConductorSegmentProfile;
@@ -34,12 +35,13 @@ typedef QHash<Qt::Corner, ConductorProfile> ConductorProfilesGroup;
This class represents a conductor, i.e. a wire between two element
terminals.
*/
class Conductor : public QObject, public QGraphicsPathItem {
class Conductor : public QObject, public QGraphicsPathItem
{
Q_OBJECT
Q_PROPERTY(QPointF pos READ pos WRITE setPos)
Q_PROPERTY(int animPath READ fakePath WRITE updatePathAnimate)
Q_PROPERTY(ConductorProperties properties READ properties WRITE setProperties)
// constructors, destructor
public: