PDA

View Full Version : Creating a button programmatically



Luc4
27th January 2010, 10:18
Hi! I'm trying to place a button in my window, and I followed the various tutorials. I created the window using the wiard, which created a new class MainWindow, and when I try:

QPushButton *b = new QPushButton(QString("ciccio"), (QWidget *)w.parent());

the button is created in a new window and not in mine. How do I have to do to place it in the MainWindow when it was not created as a QWidget like in the tutorials?
Thanks!

Luc4
27th January 2010, 10:30
Sorry, already found :-) there is an object named centralWidget which has to be used.