PDA

View Full Version : A Style Question of how Code & Files are Organised !



fassage
9th January 2010, 14:10
Hi All,

Most of all the Qt examples and structures i have familiarised myself to are simple and restricted to around 3 files which might include (main.cpp, form1.h & form1.cpp).

Lets say your developing a Dialog application with a QTabWidget with many tabs, and each tab contains many buttons/widgets. While both the form1.h class and main.cpp files are quite manageable, the form1.cpp implementation file is becoming VERY LARGE !!!

I would like to ask you what are your preferences in terms of how you would partition/organise this implementation ?

Some simple examples would be really useful too !

Many Thanks & looking forward to your replies.

wysota
9th January 2010, 15:00
You can implement each tab in a separate class (and separate two files) and then integrate them using a wrapping class. You can also refactor any class into smaller parts and use them. So the area to experiment is practically infinite.

squidge
9th January 2010, 17:41
I would put the Dialog class into it's own directory, along with a class for each tab, which would be in there own file in that directory. The controller class (which the tab classes would communicate with) would also be in that directory.