[qet] [4593] Fix copy and paste crash of Elements with Sequential Autonum |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 4593
Author: dfochi
Date: 2016-07-26 22:40:54 +0200 (Tue, 26 Jul 2016)
Log Message:
-----------
Fix copy and paste crash of Elements with Sequential Autonum
Modified Paths:
--------------
trunk/sources/qetgraphicsitem/conductor.cpp
trunk/sources/qetgraphicsitem/element.cpp
Modified: trunk/sources/qetgraphicsitem/conductor.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/conductor.cpp 2016-07-26 18:52:49 UTC (rev 4592)
+++ trunk/sources/qetgraphicsitem/conductor.cpp 2016-07-26 20:40:54 UTC (rev 4593)
@@ -1202,6 +1202,8 @@
* @return label with variables assigned
*/
QString Conductor::assignVariables(QString label) {
+ //The check below was introduced to avoid crash caused by the addition of terminal elements
+ //Needs further debbugging.
if (diagram() == NULL) return label;
//Titleblock Variables
for (int i = 0; i < diagram()->border_and_titleblock.additionalFields().count(); i++)
Modified: trunk/sources/qetgraphicsitem/element.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/element.cpp 2016-07-26 18:52:49 UTC (rev 4592)
+++ trunk/sources/qetgraphicsitem/element.cpp 2016-07-26 20:40:54 UTC (rev 4593)
@@ -856,22 +856,24 @@
*/
QString Element::assignSeq(QString label) {
for (int i = 1; i <= qMax(qMax(qMax(seq_unitfolio.size(), seq_tenfolio.size()),qMax(seq_hundredfolio.size(),seq_unit.size())),qMax(seq_hundred.size(),seq_ten.size())); i++) {
- if (label.contains("%sequ_" + QString::number(i))) {
+ // "&& !seq.isEmpty()" introduced in the methods below to avoid crash when copying and paste elements
+ // that contain folio sequential in their labels. Needs further debugging.
+ if (label.contains("%sequ_" + QString::number(i)) && !seq_unit.isEmpty()) {
label.replace("%sequ_" + QString::number(i),seq_unit.at(i-1));
}
- if (label.contains("%seqt_" + QString::number(i))) {
+ if (label.contains("%seqt_" + QString::number(i)) && !seq_ten.isEmpty()) {
label.replace("%seqt_" + QString::number(i),seq_ten.at(i-1));
}
- if (label.contains("%seqh_" + QString::number(i))) {
+ if (label.contains("%seqh_" + QString::number(i)) && !seq_hundred.isEmpty()) {
label.replace("%seqh_" + QString::number(i),seq_hundred.at(i-1));
}
- if (label.contains("%sequf_" + QString::number(i))) {
+ if (label.contains("%sequf_" + QString::number(i)) && !seq_unitfolio.isEmpty()) {
label.replace("%sequf_" + QString::number(i),seq_unitfolio.at(i-1));
}
- if (label.contains("%seqtf_" + QString::number(i))) {
+ if (label.contains("%seqtf_" + QString::number(i)) && !seq_tenfolio.isEmpty()) {
label.replace("%seqtf_" + QString::number(i),seq_tenfolio.at(i-1));
}
- if (label.contains("%seqhf_" + QString::number(i))) {
+ if (label.contains("%seqhf_" + QString::number(i)) && !seq_hundredfolio.isEmpty()) {
label.replace("%seqhf_" + QString::number(i),seq_hundredfolio.at(i-1));
}
}