mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-11 06:34:14 +02:00
c6995a0e7e
An element can declare contact groups and a max_slaves that disagree with each other, and nothing reconciles them. The element editor keeps the two in step: max_slaves sizes the contact group table, one row per slot. Nothing does so on load, so a hand written or generated file can carry five groups and max_slaves=2. That loads without complaint, isFull() then caps linking at two, and ContactGroupSelectionDialog still offers all five groups -- so the user is shown groups that cannot be linked to, with nothing to explain why. When groups are declared they are the slots: a slave occupies exactly one, and the selection dialog offers exactly these. So take the limit from the group count, which is also the number the user can see. max_slaves stays as the fallback for the elements that declare no groups, which today is every element in the standard collection. No element in the collection declares contact groups, so this changes nothing for existing projects. Verified with two purpose-built fixtures, since no real element exercises either path: a coil declaring five groups with max_slaves=2 now takes the limit from the groups, and a coil with max_slaves and no groups still takes the fallback path unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>