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
This commit is contained in:
dfochi
2016-07-11 13:03:30 +00:00
parent f8a829d328
commit 77a9dd666e
2 changed files with 5 additions and 4 deletions

View File

@@ -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 <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"));
}

View File

@@ -689,7 +689,6 @@ void Element::assignSeq() {
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 @@ 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++;
}
}