mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-13 20:23:04 +02:00
some clean-up for "elementInformations" in element-file
- for some time now and for whatever reason, element-editor sometimes adds element-information without content –> do not save info-lines without any content - sort element-information alphabetically by name in element-file - use trimmed strings for element-information to remove leading and trailing whitestpace
This commit is contained in:
parent
b0324bd6e8
commit
408481a023
@ -151,10 +151,14 @@ bool DiagramContext::operator!=(const DiagramContext &dc) const
|
||||
void DiagramContext::toXml(QDomElement &e, const QString &tag_name) const
|
||||
{
|
||||
foreach (QString key, keys()) {
|
||||
if (m_content[key].toString().trimmed().isEmpty()) { continue; }
|
||||
QDomElement property = e.ownerDocument().createElement(tag_name);
|
||||
// try to sort attributes by removing and re-adding
|
||||
property.removeAttribute("show");
|
||||
property.removeAttribute("name");
|
||||
property.setAttribute("show", m_content_show[key]);
|
||||
property.setAttribute("name", key);
|
||||
property.setAttribute("show",m_content_show[key]);
|
||||
QDomText value = e.ownerDocument().createTextNode(m_content[key].toString());
|
||||
QDomText value = e.ownerDocument().createTextNode(m_content[key].toString().trimmed());
|
||||
property.appendChild(value);
|
||||
e.appendChild(property);
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ class DiagramContext
|
||||
|
||||
void add(DiagramContext other);
|
||||
void remove(const QString &key);
|
||||
QList<QString> keys(KeyOrder = None) const;
|
||||
QList<QString> keys(KeyOrder = Alphabetical) const;
|
||||
bool contains(const QString &) const;
|
||||
const QVariant operator[](const QString &) const;
|
||||
bool addValue(const QString &, const QVariant &, bool show = true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user