mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-01-03 19:10:53 +01:00
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:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user