[qet] [2089] bug fix and minor change

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 2089
Author:   blacksun
Date:     2013-04-06 16:32:39 +0200 (Sat, 06 Apr 2013)
Log Message:
-----------
bug fix and minor change

Modified Paths:
--------------
    trunk/sources/conductorautonumerotationwidget.cpp
    trunk/sources/conductorautonumerotationwidget.h
    trunk/sources/diagramcommands.cpp

Modified: trunk/sources/conductorautonumerotationwidget.cpp
===================================================================
--- trunk/sources/conductorautonumerotationwidget.cpp	2013-04-05 16:03:05 UTC (rev 2088)
+++ trunk/sources/conductorautonumerotationwidget.cpp	2013-04-06 14:32:39 UTC (rev 2089)
@@ -6,7 +6,8 @@
 ConductorAutoNumerotationWidget::ConductorAutoNumerotationWidget(Conductor *c, QSet<Conductor *> cl, QWidget *parent) :
 	QDialog (parent),
 	conductor_(c),
-	c_list(cl)
+	c_list(cl),
+	diagram_(c -> diagram())
 {
 #ifdef Q_WS_MAC
 	setWindowFlags(Qt::Sheet);
@@ -99,9 +100,12 @@
  *applique le texte selectionne @text_ a tout les conducteur de @c_list et a @conducteur_
  */
 void ConductorAutoNumerotationWidget::applyText() {
+	QSet <Conductor *> conductorslist = c_list;
+	conductorslist << conductor_;
 	QList <ConductorProperties> old_properties, new_properties;
 	ConductorProperties cp;
-	foreach (Conductor *c, c_list) {
+
+	foreach (Conductor *c, conductorslist) {
 		old_properties << c -> properties();
 		cp = c -> properties();
 		cp.text = text_;
@@ -110,15 +114,10 @@
 		c -> setText(text_);
 	}
 	// initialise l'objet UndoCommand correspondant
-	ChangeSeveralConductorsPropertiesCommand *cscpc = new ChangeSeveralConductorsPropertiesCommand(c_list);
+	ChangeSeveralConductorsPropertiesCommand *cscpc = new ChangeSeveralConductorsPropertiesCommand(conductorslist);
 	cscpc -> setOldSettings(old_properties);
 	cscpc -> setNewSettings(new_properties);
-	conductor_ -> diagram() -> undoStack().push(cscpc);
-
-	cp = conductor_ -> properties();
-	cp.text = text_;
-	conductor_ -> setProperties(cp);
-	conductor_ -> setText(text_);
+	diagram_ -> undoStack().push(cscpc);
 }
 
 /**

Modified: trunk/sources/conductorautonumerotationwidget.h
===================================================================
--- trunk/sources/conductorautonumerotationwidget.h	2013-04-05 16:03:05 UTC (rev 2088)
+++ trunk/sources/conductorautonumerotationwidget.h	2013-04-06 14:32:39 UTC (rev 2089)
@@ -7,6 +7,7 @@
 #include <QMultiMap>
 #include <QString>
 #include "conductor.h"
+#include "diagram.h"
 
 class ConductorAutoNumerotationWidget : public QDialog
 {
@@ -28,6 +29,7 @@
 	//attributes
 	Conductor *conductor_;
 	QSet<Conductor *> c_list; //liste des conducteurs au même potentiel
+	Diagram *diagram_;
 	QList <QRadioButton *> *radio_List;
 	QLineEdit *text_field;
 	QString text_;

Modified: trunk/sources/diagramcommands.cpp
===================================================================
--- trunk/sources/diagramcommands.cpp	2013-04-05 16:03:05 UTC (rev 2088)
+++ trunk/sources/diagramcommands.cpp	2013-04-06 14:32:39 UTC (rev 2089)
@@ -989,7 +989,7 @@
 	if (old_settings_set && new_settings_set) {
 		int i=0;
 		foreach(Conductor *c, conductors) {
-			c -> setProperties(new_properties.at(0));
+			c -> setProperties(new_properties.at(i));
 			c -> update();
 			i++;
 		}


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/