View Single Post
Venemo's Avatar
Posts: 1,296 | Thanked: 1,773 times | Joined on Aug 2009 @ Budapest, Hungary
#17
Originally Posted by TNiga View Post
EDIT: And your connect seems to be now in wrong place, it's in the destructor (MainWindow::~MainWindow()) though it should be in constructor (MainWindow::MainWindow())
Yeah.
A little education:
- The destructor runs when an object (in this case, your MainWindow) is destroyed - it is the place where you should free up your memory.
- The constructor is called when your object is about to be created.

About the connect() calls - it is a good practice to put them into the constructor. However, for items in the .ui, it is best to create the slots with the designer and let it do this for you.
(That way, the connect() is taken care of by the designer and you don't have to call it yourself.)