Layouts properly removed & deleted on model change

This commit is contained in:
Raphael Coeffic
2021-04-18 07:57:41 +02:00
parent bf144290f3
commit 0ad4e6fce1
5 changed files with 20 additions and 6 deletions
+8 -2
View File
@@ -65,8 +65,7 @@ void deleteCustomScreens()
{
for (auto& screen : customScreens) {
if (screen) {
screen->detach();
delete screen;
screen->deleteLater();
screen = nullptr;
}
}
@@ -83,6 +82,13 @@ void loadDefaultLayout()
strcpy(screenData.LayoutId, defaultLayout->getId());
screen = defaultLayout->create(&screenData.layoutData);
//
// TODO:
// -> attach a few default widgets
// - ModelBmp
// - Timer
// - ???
//
if (screen) {
screen->attach(ViewMain::instance());
}
+1 -1
View File
@@ -394,7 +394,7 @@ void ScreenSetupPage::build(FormWindow * window)
// optionsWindow->getParent()->adjustInnerHeight();
}
void ScreenSetupPage::updateLayoutOptions()
void ScreenSetupPage::updateLayoutOptions() // TODO
{
#if 0
FormGridLayout grid;
-3
View File
@@ -417,10 +417,7 @@ void ViewMain::createTrims()
VERTICAL_SLIDERS_HEIGHT
};
//r.x = left() + HMARGIN + TRIM_SQUARE_SIZE; // DBG
trims[TRIMS_LV] = new MainViewVerticalTrim(this, r, 1);
//r.x = right() - HMARGIN - TRIM_SQUARE_SIZE; // DBG
trims[TRIMS_RV] = new MainViewVerticalTrim(this, r, 2);
}
+7
View File
@@ -90,6 +90,13 @@ class Widget : public FormField
{
}
#if defined(DEBUG_WINDOWS)
std::string getName() const override
{
return "Widget";
}
#endif
protected:
const WidgetFactory * factory;
PersistentData * persistentData;
+4
View File
@@ -61,6 +61,10 @@ void preModelLoad()
#endif
stopTrainer();
#if defined(COLORLCD)
deleteCustomScreens();
#endif
}
void postRadioSettingsLoad()