[qet] [4580] Allow blank selection in Auto Numbering Dock |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 4580
Author: dfochi
Date: 2016-07-18 17:23:30 +0200 (Mon, 18 Jul 2016)
Log Message:
-----------
Allow blank selection in Auto Numbering Dock
Modified Paths:
--------------
trunk/sources/configpages.cpp
trunk/sources/qetgraphicsitem/customelement.cpp
trunk/sources/qetproject.cpp
trunk/sources/ui/autonumberingdockwidget.cpp
Modified: trunk/sources/configpages.cpp
===================================================================
--- trunk/sources/configpages.cpp 2016-07-17 10:16:37 UTC (rev 4579)
+++ trunk/sources/configpages.cpp 2016-07-18 15:23:30 UTC (rev 4580)
@@ -114,6 +114,7 @@
if (m_project -> defaultTitleBlockProperties() != new_tbt_prop) {
m_project -> setDefaultTitleBlockProperties(ipw -> properties());
modified_project = true;
+ emit (m_project->defaultTitleBlockPropertiesChanged());
}
ConductorProperties new_conductor_prop = cpw -> properties();
@@ -161,7 +162,7 @@
xrp.toSettings(settings, str += key);
}
}
- emit (m_project->defaultTitleBlockPropertiesChanged());
+
}
/**
Modified: trunk/sources/qetgraphicsitem/customelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/customelement.cpp 2016-07-17 10:16:37 UTC (rev 4579)
+++ trunk/sources/qetgraphicsitem/customelement.cpp 2016-07-18 15:23:30 UTC (rev 4580)
@@ -309,7 +309,7 @@
prefix = rxml.readElementText();
DiagramContext &dc = this->rElementInformations();
//if there is a formula to assign, assign it
- if (!location().project()->elementAutoNumFormula().isEmpty() && this->linkType()!=Element::Slave) {
+ if (!(location().project()->elementAutoNumFormula().isEmpty()) && (location().project()->elementAutoNumFormula() != "") && (this->linkType()!=Element::Slave)) {
QString formula = location().project()->elementAutoNumFormula();
this->setPrefix(prefix);
dc.addValue("label", formula);
Modified: trunk/sources/qetproject.cpp
===================================================================
--- trunk/sources/qetproject.cpp 2016-07-17 10:16:37 UTC (rev 4579)
+++ trunk/sources/qetproject.cpp 2016-07-18 15:23:30 UTC (rev 4580)
@@ -1416,9 +1416,11 @@
element_autonums.setAttribute("current_formula", m_current_element_formula);
foreach (QString key, elementAutoNum().keys()) {
QDomElement element_autonum = elementAutoNum(key).toXml(xml_document, "element_autonum");
- element_autonum.setAttribute("title", key);
- element_autonum.setAttribute("formula", elementAutoNumFormula(key));
- element_autonums.appendChild(element_autonum);
+ if (key != "" && elementAutoNumFormula(key) != "") {
+ element_autonum.setAttribute("title", key);
+ element_autonum.setAttribute("formula", elementAutoNumFormula(key));
+ element_autonums.appendChild(element_autonum);
+ }
}
xml_element.appendChild(element_autonums);
}
Modified: trunk/sources/ui/autonumberingdockwidget.cpp
===================================================================
--- trunk/sources/ui/autonumberingdockwidget.cpp 2016-07-17 10:16:37 UTC (rev 4579)
+++ trunk/sources/ui/autonumberingdockwidget.cpp 2016-07-18 15:23:30 UTC (rev 4580)
@@ -103,18 +103,21 @@
this->clear();
//Conductor Combobox
+ ui->m_conductor_cb->addItem("");
QList <QString> keys_conductor = project_->conductorAutoNum().keys();
if (!keys_conductor.isEmpty()) {
foreach (QString str, keys_conductor) { ui->m_conductor_cb-> addItem(str); }
}
//Element Combobox
+ ui->m_element_cb->addItem("");
QList <QString> keys_element = project_->elementAutoNum().keys();
if (!keys_element.isEmpty()) {
foreach (QString str, keys_element) {ui->m_element_cb -> addItem(str);}
}
//Folio Combobox
+ ui->m_folio_cb->addItem("");
QList <QString> keys_folio = project_->folioAutoNum().keys();
if (!keys_folio.isEmpty()) {
foreach (QString str, keys_folio) { ui->m_folio_cb -> addItem(str);}
@@ -142,22 +145,24 @@
void AutoNumberingDockWidget::setActive() {
if (projectview_!=NULL) {
- //Conductor
- QString conductor_autonum = projectview_->currentDiagram()->diagram()->conductorsAutonumName();
- int conductor_index = ui->m_conductor_cb->findText(conductor_autonum);
- ui->m_conductor_cb->setCurrentIndex(conductor_index);
+ //Conductor
+ QString conductor_autonum = projectview_->currentDiagram()->diagram()->conductorsAutonumName();
+ int conductor_index = ui->m_conductor_cb->findText(conductor_autonum);
+ ui->m_conductor_cb->setCurrentIndex(conductor_index);
- //Element
- QString current_element_autonum = project_->elementCurrentAutoNum();
- QString element_formula = project_->elementAutoNumFormula();
- QString active_element_autonum = project_->elementAutoNum_2().key(element_formula);
- int el_index = ui->m_element_cb->findText(active_element_autonum);
- ui->m_element_cb->setCurrentIndex(el_index);
+ //Element
+ QString current_element_autonum = project_->elementCurrentAutoNum();
+ QString element_formula = project_->elementAutoNumFormula();
+ QString active_element_autonum = project_->elementAutoNum_2().key(element_formula);
+ int el_index = ui->m_element_cb->findText(active_element_autonum);
+ ui->m_element_cb->setCurrentIndex(el_index);
- //Folio
- QString page_autonum = project_->defaultTitleBlockProperties().auto_page_num;
- int folio_index = ui->m_folio_cb->findText(page_autonum);
- ui->m_folio_cb->setCurrentIndex(folio_index);
+ //Folio
+ if (project_->defaultTitleBlockProperties().folio == "%autonum") {
+ QString page_autonum = project_->defaultTitleBlockProperties().auto_page_num;
+ int folio_index = ui->m_folio_cb->findText(page_autonum);
+ ui->m_folio_cb->setCurrentIndex(folio_index);
+ }
}
}
@@ -170,6 +175,7 @@
ui->m_conductor_cb->clear();
//Conductor Combobox
+ ui->m_conductor_cb->addItem("");
QList <QString> keys_conductor = project_->conductorAutoNum().keys();
if (!keys_conductor.isEmpty()) {
foreach (QString str, keys_conductor) { ui->m_conductor_cb-> addItem(str); }
@@ -196,6 +202,7 @@
ui->m_element_cb->clear();
//Element Combobox
+ ui->m_element_cb->addItem("");
QList <QString> keys_element = project_->elementAutoNum().keys();
if (!keys_element.isEmpty()) {
foreach (QString str, keys_element) {ui->m_element_cb -> addItem(str);}
@@ -210,10 +217,12 @@
*/
void AutoNumberingDockWidget::on_m_element_cb_activated(int) {
QString current_autonum = ui->m_element_cb->currentText();
- QString current_formula = project_->elementAutoNumFormula();
- if (current_formula!=NULL) {
+ QString current_formula = project_->elementAutoNumFormula(current_autonum);
+ if (current_autonum != "") {
project_->setElementAutoNumCurrentFormula(current_formula, current_autonum);
}
+ else
+ project_->setElementAutoNumCurrentFormula("","");
}
/**
@@ -225,6 +234,7 @@
ui->m_folio_cb->clear();
//Folio Combobox
+ ui->m_folio_cb->addItem("");
QList <QString> keys_folio = project_->folioAutoNum().keys();
if (!keys_folio.isEmpty()) {
foreach (QString str, keys_folio) { ui->m_folio_cb -> addItem(str);}
@@ -239,8 +249,15 @@
*/
void AutoNumberingDockWidget::on_m_folio_cb_activated(int) {
QString current_autonum = ui->m_folio_cb->currentText();
- TitleBlockProperties ip = project_->defaultTitleBlockProperties();
- ip.setAutoPageNum(current_autonum);
- project_->setDefaultTitleBlockProperties(ip);
- emit(folioAutoNumChanged(current_autonum));
+ TitleBlockProperties ip = project_ -> defaultTitleBlockProperties();
+ if (current_autonum != "") {
+ ip.setAutoPageNum(current_autonum);
+ ip.folio = "%autonum";
+ project_->setDefaultTitleBlockProperties(ip);
+ }
+ else {
+ ip.folio = "%id/%total";
+ project_->setDefaultTitleBlockProperties(ip);
+ }
+ emit(folioAutoNumChanged(current_autonum));
}