Qqt
13th December 2010, 06:46
Hello,
I am practicing the Qt tutorial here
http://doc.qt.nokia.com/4.3/tutorial-t4.html
Note that the QPushButton quit in constructor of MyWidget is a pointer. The example code works fine. But the button doesn't show up in the window after I changed the pointer to a stack variable, like
QPushButton quit(tr("Quit"), this);
quit.setGeometry(62, 40, 75, 30);
quit.setFont(QFont("Times", 18, QFont::Bold));
connect(&quit, SIGNAL(clicked()), qApp, SLOT(quit()));
Can any expert point out why the button is not displayed after the change? Why is pointer important here? Thank you.
I am practicing the Qt tutorial here
http://doc.qt.nokia.com/4.3/tutorial-t4.html
Note that the QPushButton quit in constructor of MyWidget is a pointer. The example code works fine. But the button doesn't show up in the window after I changed the pointer to a stack variable, like
QPushButton quit(tr("Quit"), this);
quit.setGeometry(62, 40, 75, 30);
quit.setFont(QFont("Times", 18, QFont::Bold));
connect(&quit, SIGNAL(clicked()), qApp, SLOT(quit()));
Can any expert point out why the button is not displayed after the change? Why is pointer important here? Thank you.