mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-20 16:20:52 +01:00
Fix crash
This commit is contained in:
@@ -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,10 +80,12 @@ 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);
|
||||
|
||||
@@ -90,6 +96,9 @@ QDomElement TerminalStripItemXml::toXml(TerminalStripItem *item, QDomDocument &d
|
||||
dom_element.appendChild(QETXML::qGraphicsItemPosToXml(item, document));
|
||||
|
||||
return dom_element;
|
||||
} else {
|
||||
return QDomElement();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user