mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-20 08:10: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:
@@ -644,6 +644,7 @@ void Element::hoverLeaveEvent(QGraphicsSceneHoverEvent *e) {
|
||||
*/
|
||||
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 @@ 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", elmt->diagram() -> border_and_titleblock.folio());
|
||||
label.replace("%c", QString::number(elmt->diagram() -> convertPosition(elmt -> scenePos()).number()));
|
||||
|
||||
Reference in New Issue
Block a user