开发者

Use a single source file for many QtDesigner forms

I couldn't find my answer in the Qt documentation (maybe I'm inept), so here's a simple question:

Should I have separate source and header files for every QtDesigner form I have in my project, or can I (and should I) design all the GUI forms and then define their functionality in a single source and header file?

C开发者_StackOverflowonsider this is a relatively simple project with ~5 forms based around a main window.


Qt Designer files has class generation definitions. UIC generates QWidget/QMainWindow based classes from them. You can use these classes from single class using aggregation method. But i don't recommend this if you don't know what to do.

My advice is to use it as Qt way. Use seperate classes and seperate files for each form. This approach is better. Every form should need its members and MainWindow can arrange communications (signal/slot connections and other logic) for these forms.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜