Improve memory management in project window.

* Panel struct does no longer take ownership of its widget.
 * Panels consitently delete their widget in their destructor.

Reviewed-By: dt
This commit is contained in:
Tobias Hunger
2009-11-25 15:18:51 +01:00
parent 97ad692684
commit fbcd670854
6 changed files with 55 additions and 68 deletions

View File

@@ -68,21 +68,25 @@ public:
// Adds a widget
void addWidget(QWidget *widget);
void addWidget(const QString &name, QWidget *widget);
void removeWidget(QWidget *widget);
// Removes all widgets and deletes them
void clear();
private:
private:
struct Panel
{
// This does not take ownership of widget!
explicit Panel(QWidget * widget);
~Panel();
QSpacerItem *spacer;
QLabel *nameLabel;
QWidget *panelWidget;
QHBoxLayout *marginLayout;
};
QList<Panel *> m_panels;
QVBoxLayout *m_layout;
QList<Panel> m_panels;
};
class BuildConfigurationComboBox : public QStackedWidget