mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 14:50:53 +01:00
Fix autonumbering menu cano assign formulas to custom element label.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4913 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -461,13 +461,55 @@ namespace autonum
|
|||||||
dirLevel = 0;
|
dirLevel = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only Electric labels created so far
|
// Create Custom labels if qet_labels.xml if exit in customElementsDir
|
||||||
//if (current_location.fileName() != "10_electric")
|
if (current_location.fileName() != "10_electric"){
|
||||||
|
QString custom_labels = "qet_labels.xml";
|
||||||
|
QString customfilepath = QETApp::customElementsDir().append(custom_labels);
|
||||||
|
|
||||||
|
QFile file(customfilepath);
|
||||||
|
file.isReadable();
|
||||||
|
if (!file.open(QFile::ReadOnly | QFile::Text))
|
||||||
|
return QString();
|
||||||
|
rxml.setDevice(&file);
|
||||||
|
rxml.readNext();
|
||||||
|
|
||||||
|
while(!rxml.atEnd())
|
||||||
|
{
|
||||||
|
if (rxml.attributes().value("name").toString() == path[i])
|
||||||
|
{
|
||||||
|
rxml.readNext();
|
||||||
|
i=i-1;
|
||||||
|
//reached element directory
|
||||||
|
if (i==0)
|
||||||
|
{
|
||||||
|
for (int j=i; j<= dirLevel; j = j +1)
|
||||||
|
{
|
||||||
|
//if there is a prefix available apply prefix
|
||||||
|
if(rxml.name()=="prefix")
|
||||||
|
{
|
||||||
|
return rxml.readElementText();
|
||||||
|
}
|
||||||
|
//if there isn't a prefix available, find parent prefix in parent folder
|
||||||
|
else
|
||||||
|
{
|
||||||
|
while (rxml.readNextStartElement() && rxml.name()!="prefix")
|
||||||
|
{
|
||||||
|
rxml.skipCurrentElement();
|
||||||
|
rxml.readNext();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rxml.readNext();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
QString qet_labels = "10_electric/qet_labels.xml";
|
QString qet_labels = "10_electric/qet_labels.xml";
|
||||||
QString filepath = QETApp::commonElementsDir().append(qet_labels);
|
QString filepath = QETApp::commonElementsDir().append(qet_labels);
|
||||||
QFile file(filepath);
|
QFile file(filepath);
|
||||||
file.isReadable();
|
file.isReadable();
|
||||||
|
|
||||||
if (!file.open(QFile::ReadOnly | QFile::Text))
|
if (!file.open(QFile::ReadOnly | QFile::Text))
|
||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
@@ -504,7 +546,7 @@ namespace autonum
|
|||||||
}
|
}
|
||||||
rxml.readNext();
|
rxml.readNext();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user