Skip to content

Commit

Permalink
Ensure all old top bar widgets are removed when changing models.
Browse files Browse the repository at this point in the history
  • Loading branch information
philmoz committed Feb 13, 2025
1 parent d644f73 commit 06fc246
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions radio/src/gui/colorlcd/mainview/layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ void LayoutFactory::deleteCustomScreens()
screen = nullptr;
}
}

ViewMain::instance()->getTopbar()->removeAllWidgets();
}

void LayoutFactory::loadDefaultLayout()
Expand Down
6 changes: 6 additions & 0 deletions radio/src/gui/colorlcd/mainview/widgets_container_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ class WidgetsContainerImpl : public WidgetsContainer

virtual void create() { memset(persistentData, 0, sizeof(PersistentData)); }

void removeAllWidgets()
{
for (unsigned int i = 0; i < N; i++)
removeWidget(i);
}

virtual void load()
{
unsigned int count = getZonesCount();
Expand Down

0 comments on commit 06fc246

Please sign in to comment.