* @brief Clears all widgets from the registry. */
| 182 | * @brief Clears all widgets from the registry. |
| 183 | */ |
| 184 | void UI::WidgetRegistry::clear() |
| 185 | { |
| 186 | auto idsToDestroy = m_widgetOrder; |
| 187 | std::reverse(idsToDestroy.begin(), idsToDestroy.end()); |
| 188 | |
| 189 | for (const auto& id : idsToDestroy) { |
| 190 | Q_EMIT widgetDestroyed(id); |
| 191 | m_widgets.remove(id); |
| 192 | } |
| 193 | |
| 194 | m_widgetOrder.clear(); |
| 195 | |
| 196 | Q_EMIT registryCleared(); |
| 197 | } |
| 198 | |
| 199 | /** |
| 200 | * @brief Destroys a widget and removes it from the registry. |