mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-13 16:34:14 +02:00
Merge pull request #997 from ispyisail/revive/659-preserve-links
Linux build and tests / Build and test (Qt 6, Debug) (push) Failing after 2m15s
Linux build and tests / Build and test (Qt 6, Debug) (push) Failing after 2m15s
Preserve master/slave links when pasting or duplicating a folio
This commit is contained in:
@@ -1386,6 +1386,33 @@ void Element::initLink(QETProject *prj)
|
||||
tmp_uuids_link.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Element::initLink
|
||||
Overload resolving tmp_uuids_link against @p candidates instead of a
|
||||
project-wide ElementProvider search -- see the header comment for
|
||||
why the search has to be scoped this way right after a paste or
|
||||
folio-duplication XML round-trip, before uuids are renewed.
|
||||
@param candidates the elements to search for a link partner in
|
||||
*/
|
||||
void Element::initLink(const QList<Element *> &candidates)
|
||||
{
|
||||
// if nothing to link return now
|
||||
if (tmp_uuids_link.isEmpty()) return;
|
||||
|
||||
for (int i = 0; i < tmp_uuids_link.size(); ++i) {
|
||||
for (Element *elmt : candidates) {
|
||||
if (elmt->uuid() == tmp_uuids_link[i].uuid) {
|
||||
elmt->linkToElement(this);
|
||||
if (tmp_uuids_link[i].group_index >= 0) {
|
||||
m_group_index_map[elmt] = tmp_uuids_link[i].group_index;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
tmp_uuids_link.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Element::linkTypeToString
|
||||
* \deprecated use instead ElementData::typeToString
|
||||
|
||||
Reference in New Issue
Block a user