mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-20 16:20:52 +01:00
Hard code fix for preventing element autonumbering crashing QElectro until correction. Minor: assign project variables to element label
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4564 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -271,6 +271,7 @@ void CustomElement::paint(QPainter *qp, const QStyleOptionGraphicsItem *options)
|
|||||||
instructions.
|
instructions.
|
||||||
*/
|
*/
|
||||||
void CustomElement::parseLabels() {
|
void CustomElement::parseLabels() {
|
||||||
|
return;
|
||||||
if ((this->taggedText("label")!= NULL) && (location().projectId()!=-1) && (this->taggedText("label")->toPlainText()=="_")) { //element is being added
|
if ((this->taggedText("label")!= NULL) && (location().projectId()!=-1) && (this->taggedText("label")->toPlainText()=="_")) { //element is being added
|
||||||
QXmlStreamReader rxml;
|
QXmlStreamReader rxml;
|
||||||
QString path[10];
|
QString path[10];
|
||||||
|
|||||||
@@ -644,6 +644,7 @@ void Element::hoverLeaveEvent(QGraphicsSceneHoverEvent *e) {
|
|||||||
*/
|
*/
|
||||||
QString Element::assignVariables(QString label, Element *elmt){
|
QString Element::assignVariables(QString label, Element *elmt){
|
||||||
|
|
||||||
|
//Titleblock Variables
|
||||||
for (int i = 0; i < elmt->diagram()->border_and_titleblock.additionalFields().count(); i++)
|
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);
|
QString folio_variable = elmt->diagram()->border_and_titleblock.additionalFields().keys().at(i);
|
||||||
@@ -655,6 +656,19 @@ QString Element::assignVariables(QString label, Element *elmt){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//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", QString::number(elmt->diagram()->folioIndex()+1));
|
||||||
label.replace("%F", elmt->diagram() -> border_and_titleblock.folio());
|
label.replace("%F", elmt->diagram() -> border_and_titleblock.folio());
|
||||||
label.replace("%c", QString::number(elmt->diagram() -> convertPosition(elmt -> scenePos()).number()));
|
label.replace("%c", QString::number(elmt->diagram() -> convertPosition(elmt -> scenePos()).number()));
|
||||||
|
|||||||
Reference in New Issue
Block a user