[qet] [4570] Corrected element autonumbering sequential format 01 and 001.

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


Revision: 4570
Author:   dfochi
Date:     2016-07-11 15:03:30 +0200 (Mon, 11 Jul 2016)
Log Message:
-----------
Corrected element autonumbering sequential format 01 and 001. Corrected nameless element autonumbering treatment.

Modified Paths:
--------------
    trunk/sources/projectconfigpages.cpp
    trunk/sources/qetgraphicsitem/element.cpp

Modified: trunk/sources/projectconfigpages.cpp
===================================================================
--- trunk/sources/projectconfigpages.cpp	2016-07-10 01:33:49 UTC (rev 4569)
+++ trunk/sources/projectconfigpages.cpp	2016-07-11 13:03:30 UTC (rev 4570)
@@ -513,7 +513,7 @@
 	// With the the name "No name"
 	if (m_context_cb_element -> currentText() == tr("Nom de la nouvelle numérotation")) {
 		project_->addElementAutoNum (tr("Sans nom"), m_saw_element -> toNumContext());
-		project()->addElementAutoNumFormula (m_context_cb_element->currentText(), m_saw_element->elementFormula()); //add hash <title, formula>
+		project()->addElementAutoNumFormula (tr("Sans nom"), m_saw_element->elementFormula()); //add hash <title, formula>
 		project()->addElementAutoNumCurrentFormula (m_saw_element->elementFormula()); //add last added element formula to current formula
 		m_context_cb_element -> addItem(tr("Sans nom"));
 	}

Modified: trunk/sources/qetgraphicsitem/element.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/element.cpp	2016-07-10 01:33:49 UTC (rev 4569)
+++ trunk/sources/qetgraphicsitem/element.cpp	2016-07-11 13:03:30 UTC (rev 4570)
@@ -689,7 +689,6 @@
 	QHash <QString,QString> hash = diagram()->project()->elementAutoNum_2();
 	QString formula_name = hash.key(formula);
 	QString label = dc["label"].toString();
-	qDebug() << "Label" << label;
 	NumerotationContext nc = diagram()->project()->elementAutoNum(formula_name);
 	NumerotationContextCommands ncc (nc);
 	if (!nc.isEmpty()) {
@@ -706,7 +705,8 @@
 			int count = 1;
 			for (int i = 0; i < nc.size(); i++) {
 				if (nc.itemAt(i).at(0) == "ten") {
-					label.replace("%seqt_" + QString::number(count), QString::number(nc.itemAt(i).at(1).toInt()));
+					QString number = QString("%1").arg(nc.itemAt(i).at(1).toInt(), 2, 10, QChar('0'));
+					label.replace("%seqt_" + QString::number(count), number);
 					count++;
 				}
 			}
@@ -715,7 +715,8 @@
 			int count = 1;
 			for (int i = 0; i < nc.size(); i++) {
 				if (nc.itemAt(i).at(0) == "hundred") {
-					label.replace("%seqh_" + QString::number(count), QString::number(nc.itemAt(i).at(1).toInt()));
+					QString number = QString("%1").arg(nc.itemAt(i).at(1).toInt(), 3, 10, QChar('0'));
+					label.replace("%seqh_" + QString::number(count), number);
 					count++;
 				}
 			}


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