From 77a9dd666ef18a42ddcc9c888b90d9d0e0eed1c0 Mon Sep 17 00:00:00 2001 From: dfochi Date: Mon, 11 Jul 2016 13:03:30 +0000 Subject: [PATCH] Corrected element autonumbering sequential format 01 and 001. Corrected nameless element autonumbering treatment. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4570 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/projectconfigpages.cpp | 2 +- sources/qetgraphicsitem/element.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sources/projectconfigpages.cpp b/sources/projectconfigpages.cpp index 8ba62fe7c..7a8a99ab6 100644 --- a/sources/projectconfigpages.cpp +++ b/sources/projectconfigpages.cpp @@ -513,7 +513,7 @@ void ProjectAutoNumConfigPage::saveContext_element() { // 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 + project()->addElementAutoNumFormula (tr("Sans nom"), m_saw_element->elementFormula()); //add hash project()->addElementAutoNumCurrentFormula (m_saw_element->elementFormula()); //add last added element formula to current formula m_context_cb_element -> addItem(tr("Sans nom")); } diff --git a/sources/qetgraphicsitem/element.cpp b/sources/qetgraphicsitem/element.cpp index 4da4881dd..e1aa44210 100644 --- a/sources/qetgraphicsitem/element.cpp +++ b/sources/qetgraphicsitem/element.cpp @@ -689,7 +689,6 @@ void Element::assignSeq() { QHash 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 @@ void Element::assignSeq() { 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 @@ void Element::assignSeq() { 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++; } }