mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 13:30:34 +01:00
fix a bug when change a conductor property on multiple conductor potential with conductor dialog property
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2119 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -37,7 +37,6 @@
|
|||||||
#include "qeticons.h"
|
#include "qeticons.h"
|
||||||
#include "qetmessagebox.h"
|
#include "qetmessagebox.h"
|
||||||
#include "qtextorientationspinboxwidget.h"
|
#include "qtextorientationspinboxwidget.h"
|
||||||
#include "conductorautonumerotation.h"
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -989,16 +988,39 @@ void DiagramView::editConductor(Conductor *edited_conductor) {
|
|||||||
ConductorProperties new_properties = cpw -> conductorProperties();
|
ConductorProperties new_properties = cpw -> conductorProperties();
|
||||||
if (new_properties != old_properties) {
|
if (new_properties != old_properties) {
|
||||||
int qmbreturn=0;
|
int qmbreturn=0;
|
||||||
//if conductor isn't alone at this potential
|
//if conductor isn't alone at this potential and text is changed
|
||||||
//ask user to apply text on every conductors of this potential
|
//ask user to apply text on every conductors of this potential
|
||||||
if (edited_conductor -> relatedPotentialConductors().size() >= 1){
|
if ((edited_conductor -> relatedPotentialConductors().size() >= 1) && (old_properties.text != new_properties.text)){
|
||||||
qmbreturn = QMessageBox::question(diagramEditor(), tr("Textes de conducteurs"),
|
qmbreturn = QMessageBox::question(diagramEditor(), tr("Textes de conducteurs"),
|
||||||
tr("Voulez-vous appliquer le nouveau texte \n"
|
tr("Voulez-vous appliquer le nouveau texte \n"
|
||||||
"\340 l'ensemble des conducteurs de ce potentiel ?"),
|
"\340 l'ensemble des conducteurs de ce potentiel ?"),
|
||||||
QMessageBox::No| QMessageBox::Yes, QMessageBox::Yes);
|
QMessageBox::No| QMessageBox::Yes, QMessageBox::Yes);
|
||||||
|
|
||||||
if (qmbreturn == QMessageBox::Yes){
|
if (qmbreturn == QMessageBox::Yes){
|
||||||
ConductorAutoNumerotation can(edited_conductor);
|
QSet <Conductor *> conductorslist = edited_conductor -> relatedPotentialConductors();
|
||||||
can.setText(new_properties.text);
|
conductorslist << edited_conductor;
|
||||||
|
QList <ConductorProperties> old_properties_list, new_properties_list;
|
||||||
|
ConductorProperties cp;
|
||||||
|
|
||||||
|
foreach (Conductor *c, conductorslist) {
|
||||||
|
if (c == edited_conductor) {
|
||||||
|
old_properties_list << old_properties;
|
||||||
|
new_properties_list << new_properties;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
old_properties_list << c -> properties();
|
||||||
|
cp = c -> properties();
|
||||||
|
cp.text = new_properties.text;
|
||||||
|
c -> setProperties(cp);
|
||||||
|
new_properties_list << c -> properties();
|
||||||
|
c -> setText(new_properties.text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//initialize the corresponding UndoCommand object
|
||||||
|
ChangeSeveralConductorsPropertiesCommand *cscpc = new ChangeSeveralConductorsPropertiesCommand(conductorslist);
|
||||||
|
cscpc -> setOldSettings(old_properties_list);
|
||||||
|
cscpc -> setNewSettings(new_properties_list);
|
||||||
|
diagram() -> undoStack().push(cscpc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (qmbreturn == 0 || qmbreturn == QMessageBox::No) {
|
if (qmbreturn == 0 || qmbreturn == QMessageBox::No) {
|
||||||
|
|||||||
Reference in New Issue
Block a user