class MyWidget : public QWidget { public: MyWidget( QWidget *parent=0, const char *name=0 ); }; MyWidget::MyWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) { QPushButton *quit = new QPushButton( "Quit", this, "quit" ); quit->setGeometry( 62, 40, 75, 30 ); quit->setFont( QFont( "Times", 18, QFont::Bold ) ); }
In the above code, quit is highlighted in Heap, and this is necessary because it is a child of MyWidget
Why does Qt require allocating children on the heap?
qt
yesraaj
source share