PDA

View Full Version : Project structure with Qt designer



lmax
11th June 2008, 11:36
I am new to QT programming..

I am quite confused by the classes generated with Qt Designer, I don't know WHERE to put my code, if I want to encapsulate my own logic in other classes.

My project's name is mt, so the Designer generated classes below:

Ui_mtClass
mtClass
mt

the Ui_mtClass cannot be changed manually, while mtClass only has a declaration(no defination). Does that mean I have to define the mtClass in a new cpp file, and add my code there ??

Additionally, the Designer only add the connections to Ui_mtClass, but no slots defination code added, it is so strange.. And the mtClass has no corresponding cpp or .h file generated, just a declaration...

Is there any UML or some thing brifely show the architecture of a QT project??:(

jacek
12th June 2008, 01:17
the Ui_mtClass cannot be changed manually, while mtClass only has a declaration(no defination). Does that mean I have to define the mtClass in a new cpp file, and add my code there ??
No, you are supposed to create a new class that inherits QWidget or something else and use the Ui::mtClass in it.

Read this: http://doc.trolltech.com/4.4/designer-using-a-component.html

Personally I prefer the single inheritance approach.