MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / setWidgetIndex

Method setWidgetIndex

app/src/UI/DashboardWidget.cpp:225–245  ·  view source on GitHub ↗

* @brief Selects and configures the appropriate widget for the given @a index. */

Source from the content-addressed store, hash-verified

223 * @brief Selects and configures the appropriate widget for the given @a index.
224 */
225void UI::DashboardWidget::setWidgetIndex(const int index)
226{
227 if (index < 0 || index >= UI::Dashboard::instance().totalWidgetCount())
228 return;
229
230 m_index = index;
231 m_widgetType = UI::Dashboard::instance().widgetType(index);
232 m_relativeIndex = UI::Dashboard::instance().relativeIndex(index);
233
234 if (m_dbWidget) {
235 m_dbWidget->deleteLater();
236 m_dbWidget = nullptr;
237 }
238
239 buildWidgetForType();
240
241 if (m_dbWidget)
242 m_dbWidget->setParentItem(this);
243
244 Q_EMIT widgetIndexChanged();
245}
246
247/**
248 * @brief Constructs the QQuickItem and selects the QML path for the current widget type.

Callers

nothing calls this directly

Calls 3

totalWidgetCountMethod · 0.80
widgetTypeMethod · 0.45
relativeIndexMethod · 0.45

Tested by

no test coverage detected