* @brief Counts the number of instances of a specified widget type. */
| 521 | * @brief Counts the number of instances of a specified widget type. |
| 522 | */ |
| 523 | int UI::Dashboard::widgetCount(const SerialStudio::DashboardWidget widget) const |
| 524 | { |
| 525 | if (SerialStudio::isGroupWidget(widget)) { |
| 526 | auto it = m_widgetGroups.constFind(widget); |
| 527 | return it != m_widgetGroups.cend() ? it->count() : 0; |
| 528 | } |
| 529 | |
| 530 | if (SerialStudio::isDatasetWidget(widget)) { |
| 531 | auto it = m_widgetDatasets.constFind(widget); |
| 532 | return it != m_widgetDatasets.cend() ? it->count() : 0; |
| 533 | } |
| 534 | |
| 535 | return 0; |
| 536 | } |
| 537 | |
| 538 | //-------------------------------------------------------------------------------------------------- |
| 539 | // Specialized data access |
no test coverage detected