Window::~Window() is now in charge of calling deleteLater for all children

This commit is contained in:
Bertrand Songis
2019-10-20 11:14:35 +02:00
parent 4bcce12d76
commit deef13e80c
6 changed files with 3 additions and 20 deletions
-5
View File
@@ -78,8 +78,3 @@ ColorEdit::ColorEdit(FormGroup * parent, const rect_t & rect, std::function<uint
}); });
} }
} }
ColorEdit::~ColorEdit()
{
deleteChildren();
}
-2
View File
@@ -32,8 +32,6 @@ class ColorEdit : public FormGroup {
return "ColorEdit"; return "ColorEdit";
} }
#endif #endif
~ColorEdit() override;
}; };
#endif // _COLOREDIT_H_ #endif // _COLOREDIT_H_
-5
View File
@@ -85,11 +85,6 @@ class FormGroup: public FormField {
{ {
} }
~FormGroup() override
{
deleteChildren(); // TODO move it to ~Window()
}
#if defined(DEBUG_WINDOWS) #if defined(DEBUG_WINDOWS)
std::string getName() override std::string getName() override
{ {
+2 -2
View File
@@ -57,7 +57,7 @@ class MenuWindow: public Window {
}; };
public: public:
MenuWindow(Menu * parent); explicit MenuWindow(Menu * parent);
#if defined(DEBUG_WINDOWS) #if defined(DEBUG_WINDOWS)
std::string getName() override std::string getName() override
@@ -126,7 +126,7 @@ class Menu : public Window {
~Menu() override ~Menu() override
{ {
delete toolbar; menuWindow.detach();
} }
void setCancelHandler(std::function<void()> handler) void setCancelHandler(std::function<void()> handler)
-5
View File
@@ -77,11 +77,6 @@ class MenuToolbar: public FormGroup {
{ {
} }
~MenuToolbar() override
{
deleteChildren();
}
void paint(BitmapBuffer * dc) override void paint(BitmapBuffer * dc) override
{ {
dc->clear(DISABLE_COLOR); dc->clear(DISABLE_COLOR);
+1 -1
View File
@@ -46,7 +46,7 @@ Window::~Window()
focusWindow = nullptr; focusWindow = nullptr;
} }
// TODO deleteChildren(); (remove from FormGroup) deleteChildren();
} }
void Window::attach(Window * window) void Window::attach(Window * window)