Hello QT Geeks!

I have to create GUI for my application and after re-search I've had to choose between wxWidgets and QT, and my choice was QT.
I've downloaded newest QT Version from http://qt.nokia.com (i.e. 4.6.3), MinGW 5.1.6 and Code::Blocks (Also latest version.) and I'm working on Windows XP Professional Service Pack 3.
I've configured my Code::Blocks using some wiki tutorial (Can't remember where did I find the link so can't post :/).

Basically I need 2 "windows" in 2 classes:
a) Login Window with 2 static texts, 2 text boxes and 3 push buttons.
b) Client window with few tabs, buttons and such.

Here's my code:

main.cpp:
Qt Code:
  1. #include <QApplication>
  2. #include "LoginInterface.h"
  3.  
  4. int main(int argc, char *argv[])
  5. {
  6. QApplication app(argc, argv);
  7.  
  8. LoginInterface li;
  9. li.show();
  10.  
  11. return app.exec();
  12. }
To copy to clipboard, switch view to plain text mode 

LoginInterface.cpp:
Qt Code:
  1. #include <QLabel>
  2.  
  3. #include "LoginInterface.h"
  4.  
  5. LoginInterface::LoginInterface()
  6. {
  7. QLabel *NameDialog = new QLabel(tr("Name:"));
  8. NameDialog->show();
  9. }
To copy to clipboard, switch view to plain text mode 

LoginInterface.h:
Qt Code:
  1. #ifndef LOGININTERFACE_H
  2. #define LOGININTERFACE_H
  3.  
  4. #include <QMainWindow>
  5.  
  6. class LoginInterface : public QMainWindow
  7. {
  8. Q_OBJECT
  9. public:
  10. LoginInterface();
  11. };
  12.  
  13. #endif
To copy to clipboard, switch view to plain text mode 

As you can see in LoginInterface header file, there's Q_OBJECT variable, but with this variable I'm getting following errors:
Qt Code:
  1. obj\LoginInterface.o:LoginInterface.cpp:(.text+0x66): undefined reference to `LoginInterface::staticMetaObject'
  2. obj\LoginInterface.o:LoginInterface.cpp:(.text+0x71): undefined reference to `vtable for LoginInterface'
  3. obj\LoginInterface.o:LoginInterface.cpp:(.text+0x78): undefined reference to `vtable for LoginInterface'
  4. obj\LoginInterface.o:LoginInterface.cpp:(.text+0x1f8): undefined reference to `vtable for LoginInterface'
  5. obj\LoginInterface.o:LoginInterface.cpp:(.text+0x1ff): undefined reference to `vtable for LoginInterface'
  6. obj\LoginInterface.o:LoginInterface.cpp:(.text+0x213): undefined reference to `LoginInterface::staticMetaObject'
To copy to clipboard, switch view to plain text mode 

But when I remove that (Yea I know, ugly cheat. :p), everything compiles fine, but GUI comes with separated windows, like on this screen:


Is there any way to fix Q_OBJECT thing and fix windows, so new controls will be CHILDS, not separated windows?

Also I've tried other ready code and C::B threw me error about 'Undefined QThread' or something, do I miss some parts of QT or?

Cheers, Diath.
PS: I hope you'll understand my english, it's kinda bad but i tried to write as proper as I can.