* @brief Creates a new widget and assigns a unique ID. */
| 83 | * @brief Creates a new widget and assigns a unique ID. |
| 84 | */ |
| 85 | UI::WidgetID UI::WidgetRegistry::createWidget(SerialStudio::DashboardWidget type, |
| 86 | const QString& title, |
| 87 | int groupId, |
| 88 | int datasetIndex, |
| 89 | bool isGroupWidget) |
| 90 | { |
| 91 | WidgetInfo info; |
| 92 | info.id = m_nextId++; |
| 93 | info.type = type; |
| 94 | info.title = title; |
| 95 | info.groupId = groupId; |
| 96 | info.datasetIndex = datasetIndex; |
| 97 | info.isGroupWidget = isGroupWidget; |
| 98 | |
| 99 | m_widgetOrder.append(info.id); |
| 100 | m_widgets.insert(info.id, info); |
| 101 | |
| 102 | if (m_batchDepth > 0) |
| 103 | m_batchHadChanges = true; |
| 104 | |
| 105 | Q_EMIT widgetCreated(info.id, info); |
| 106 | |
| 107 | return info.id; |
| 108 | } |
| 109 | |
| 110 | /** |
| 111 | * @brief Retrieves widget information by ID. |