mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-13 20:23:04 +02:00
Fix crash
This commit is contained in:
parent
1e2bdc203b
commit
b1f6b1823a
@ -100,6 +100,7 @@ void TerminalStripItem::refreshPending()
|
||||
for (const auto &strip_ : diagram()->project()->terminalStrip()) {
|
||||
if (strip_->uuid() == m_pending_strip_uuid) {
|
||||
setTerminalStrip(strip_);
|
||||
m_pending_strip_uuid = QUuid();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -924,12 +924,14 @@ QDomDocument Diagram::toXml(bool whole_content) {
|
||||
auto table = static_cast<QetGraphicsTableItem *>(qgi);
|
||||
if (whole_content || table->isSelected())
|
||||
table_vector << table;
|
||||
break;
|
||||
}
|
||||
case TerminalStripItem::Type: {
|
||||
const auto strip = static_cast<TerminalStripItem *>(qgi);
|
||||
if (whole_content || strip->isSelected()) {
|
||||
strip_vector << strip;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,8 +38,12 @@ const QString STRIP_ITEMS_TAG_NAME { QStringLiteral("terminal_strip_items") };
|
||||
QDomElement TerminalStripItemXml::toXml(const QVector<TerminalStripItem *> &items, QDomDocument &document)
|
||||
{
|
||||
auto dom_element = document.createElement(STRIP_ITEMS_TAG_NAME);
|
||||
for (const auto &item : items) {
|
||||
dom_element.appendChild(toXml(item, document));
|
||||
for (const auto &item : items)
|
||||
{
|
||||
const auto child_ = toXml(item, document);
|
||||
if (!child_.isNull()) {
|
||||
dom_element.appendChild(child_);
|
||||
}
|
||||
}
|
||||
|
||||
return dom_element;
|
||||
@ -76,20 +80,25 @@ QVector<TerminalStripItem *> TerminalStripItemXml::fromXml(Diagram *diagram, con
|
||||
* Save @a item to an xml element with tag "terminal_strip_item"
|
||||
* @param item : item to save in xml
|
||||
* @param document : parent document used to create the QDomElement returned by this function.
|
||||
* @return QDomElement where are saved @a item.
|
||||
* @return QDomElement where are saved @a item, note that the returned QDomElement can be null.
|
||||
*/
|
||||
QDomElement TerminalStripItemXml::toXml(TerminalStripItem *item, QDomDocument &document)
|
||||
{
|
||||
if (item->terminalStrip())
|
||||
{
|
||||
//Terminal strip item dom element
|
||||
auto dom_element = document.createElement(STRIP_ITEM_TAG_NAME);
|
||||
auto dom_element = document.createElement(STRIP_ITEM_TAG_NAME);
|
||||
|
||||
auto dom_strip = document.createElement(QStringLiteral("terminal_strip"));
|
||||
dom_strip.setAttribute(QStringLiteral("uuid"), item->terminalStrip()->uuid().toString());
|
||||
dom_element.appendChild(dom_strip);
|
||||
auto dom_strip = document.createElement(QStringLiteral("terminal_strip"));
|
||||
dom_strip.setAttribute(QStringLiteral("uuid"), item->terminalStrip()->uuid().toString());
|
||||
dom_element.appendChild(dom_strip);
|
||||
|
||||
dom_element.appendChild(QETXML::qGraphicsItemPosToXml(item, document));
|
||||
dom_element.appendChild(QETXML::qGraphicsItemPosToXml(item, document));
|
||||
|
||||
return dom_element;
|
||||
return dom_element;
|
||||
} else {
|
||||
return QDomElement();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user