* @brief Collects (windowId, widgetType, relativeIndex) triples that belong to groupId. */
| 996 | * @brief Collects (windowId, widgetType, relativeIndex) triples that belong to groupId. |
| 997 | */ |
| 998 | void UI::Taskbar::collectGroupWidgetIds(int groupId, |
| 999 | QList<int>& windowIds, |
| 1000 | QList<int>& relativeIds, |
| 1001 | QList<SerialStudio::DashboardWidget>& widgetTypes) const |
| 1002 | { |
| 1003 | auto* db = &UI::Dashboard::instance(); |
| 1004 | const auto& widgetMap = db->widgetMap(); |
| 1005 | for (auto it = widgetMap.begin(); it != widgetMap.end(); ++it) { |
| 1006 | const auto windowId = it.key(); |
| 1007 | const auto widgetType = it.value().first; |
| 1008 | const auto relativeIndex = it.value().second; |
| 1009 | |
| 1010 | int candidateGroup = -1; |
| 1011 | if (SerialStudio::isGroupWidget(widgetType)) |
| 1012 | candidateGroup = db->getGroupWidget(widgetType, relativeIndex).groupId; |
| 1013 | |
| 1014 | else if (SerialStudio::isDatasetWidget(widgetType)) |
| 1015 | candidateGroup = db->getDatasetWidget(widgetType, relativeIndex).groupId; |
| 1016 | |
| 1017 | else |
| 1018 | continue; |
| 1019 | |
| 1020 | if (candidateGroup != groupId) |
| 1021 | continue; |
| 1022 | |
| 1023 | windowIds.append(windowId); |
| 1024 | widgetTypes.append(widgetType); |
| 1025 | relativeIds.append(relativeIndex); |
| 1026 | } |
| 1027 | } |
| 1028 | |
| 1029 | /** |
| 1030 | * @brief Builds and appends a single child QStandardItem under the given group item. |