* @brief Walks one workspace's refs against the new group/dataset layout, refreshing * the dataset slot. The group identity is uniqueId-based so it never needs remapping. */
| 3707 | * the dataset slot. The group identity is uniqueId-based so it never needs remapping. |
| 3708 | */ |
| 3709 | static void resolveOneWorkspaceRefs(DataModel::Workspace& ws, |
| 3710 | const std::vector<detail::RefAnchor>& src, |
| 3711 | const std::vector<DataModel::Group>& groups) |
| 3712 | { |
| 3713 | Q_ASSERT(src.size() == ws.widgetRefs.size()); |
| 3714 | |
| 3715 | for (size_t i = 0; i < ws.widgetRefs.size(); ++i) { |
| 3716 | auto& r = ws.widgetRefs[i]; |
| 3717 | const auto& a = src[i]; |
| 3718 | |
| 3719 | if (a.sourceGid < 0 || a.isGroupOrLed) |
| 3720 | continue; |
| 3721 | |
| 3722 | auto git = std::find_if(groups.begin(), groups.end(), [uid = r.groupUniqueId](const auto& g) { |
| 3723 | return g.uniqueId == uid; |
| 3724 | }); |
| 3725 | if (git == groups.end()) |
| 3726 | continue; |
| 3727 | |
| 3728 | const int newSlot = slotForAnchor(a, *git); |
| 3729 | if (newSlot >= 0) |
| 3730 | r.relativeIndex = newSlot; |
| 3731 | } |
| 3732 | } |
| 3733 | |
| 3734 | /** |
| 3735 | * @brief Moves a group from one position to another, preserving widget settings, |
no test coverage detected