mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-10 14:14:18 +02:00
Fix master's failing link order test: sort a copy in linkedElements()
Element::linkedElements() sorted the element's own list of linked elements by position before returning it, so any caller reordered what is saved. #1441 restores the file's order after linking; #1442 fills the link table through linkedElements(), which sorted it again, so on master a coil's contacts are saved in position order and tst_resaveunchanged::savedLinkOrderKept fails. linkedElements() now returns a sorted copy. Callers still get the list by position; the saved order is left alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019Wga9B92BNurDEtxxtCDxf
This commit is contained in:
@@ -370,15 +370,14 @@ inline QUuid Element::uuid() const
|
||||
|
||||
/**
|
||||
@brief Element::linkedElements
|
||||
@return the list of linked elements, the list is sorted by position
|
||||
@return the list of linked elements, sorted by position. A sorted copy:
|
||||
the element's own list keeps the order it is saved in.
|
||||
*/
|
||||
inline QList <Element *> Element::linkedElements()
|
||||
{
|
||||
std::sort(
|
||||
connected_elements.begin(),
|
||||
connected_elements.end(),
|
||||
comparPos);
|
||||
return connected_elements;
|
||||
QList <Element *> sorted = connected_elements;
|
||||
std::sort(sorted.begin(), sorted.end(), comparPos);
|
||||
return sorted;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user