[qet] [4564] Hard code fix for preventing element autonumbering crashing QElectro until correction. |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 4564
Author: dfochi
Date: 2016-07-06 16:46:53 +0200 (Wed, 06 Jul 2016)
Log Message:
-----------
Hard code fix for preventing element autonumbering crashing QElectro until correction. Minor: assign project variables to element label
Modified Paths:
--------------
trunk/sources/qetgraphicsitem/customelement.cpp
trunk/sources/qetgraphicsitem/element.cpp
Modified: trunk/sources/qetgraphicsitem/customelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/customelement.cpp 2016-07-05 20:14:14 UTC (rev 4563)
+++ trunk/sources/qetgraphicsitem/customelement.cpp 2016-07-06 14:46:53 UTC (rev 4564)
@@ -271,6 +271,7 @@
instructions.
*/
void CustomElement::parseLabels() {
+ return;
if ((this->taggedText("label")!= NULL) && (location().projectId()!=-1) && (this->taggedText("label")->toPlainText()=="_")) { //element is being added
QXmlStreamReader rxml;
QString path[10];
Modified: trunk/sources/qetgraphicsitem/element.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/element.cpp 2016-07-05 20:14:14 UTC (rev 4563)
+++ trunk/sources/qetgraphicsitem/element.cpp 2016-07-06 14:46:53 UTC (rev 4564)
@@ -644,6 +644,7 @@
*/
QString Element::assignVariables(QString label, Element *elmt){
+ //Titleblock Variables
for (int i = 0; i < elmt->diagram()->border_and_titleblock.additionalFields().count(); i++)
{
QString folio_variable = elmt->diagram()->border_and_titleblock.additionalFields().keys().at(i);
@@ -655,6 +656,19 @@
}
}
+ //Project Variables
+ for (int i = 0; i < elmt->diagram()->project()->projectProperties().count(); i++)
+ {
+ QString folio_variable = elmt->diagram()->project()->projectProperties().keys().at(i);
+ QVariant folio_value = elmt->diagram()->project()->projectProperties().operator [](folio_variable);
+
+ if (label.contains(folio_variable)) {
+ label.replace("%{" + folio_variable + "}", folio_value.toString());
+ label.replace("%" + folio_variable , folio_value.toString());
+ }
+ }
+
+ //Default Variables
label.replace("%f", QString::number(elmt->diagram()->folioIndex()+1));
label.replace("%F", elmt->diagram() -> border_and_titleblock.folio());
label.replace("%c", QString::number(elmt->diagram() -> convertPosition(elmt -> scenePos()).number()));