It is not clear if you are trying to make a main window or just widget, although I will assume widget in which case the first include would be widget.h instead of mainwindow.h. The main.cpp is only meant to initialize the program and everything else should have its own class with a .h and .cpp file. If you use creator all that will be done for you for the most part along with creating a .ui file that contains most of what you have in XML format.
I see now that you have a mainwindow.h, that is where you should be adding code along with mainwindow.cpp.