Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

When to call destructor..?

$
0
0
Here is what my class looks like class Window : public QWidget {     Q_OBJECT public:     Window();  static bool  fullscreen; protected:  void keyPressEvent(QKeyEvent *event); private:     GLWidget *glWidget; }; and I am calling allocating memory in constructor by calling glWidget = new GLWidget; QBoxLayout *mainLayout = new QBoxLayout((QBoxLayout::Direction)0, 0); now, when do I call destructor to call delete glWidget and mainLayout..? I mean how exactly will I know when window is closed? I read something like “reimplementing” closewindow event; but I do not wish to “reimplement” it, all I want is to clear the durt I have created and then pass on the control to qt; I do not want(rather cannot) to clear the durt created by Qt internally. Thanks Andrew

Viewing all articles
Browse latest Browse all 18427