简体   繁体   English

如何创建一个多窗口小部件Qt应用程序

[英]How to create a Multi widgets Qt application

Is it possible to develop an application with a multitude of interfaces (widgets), where each widget has its own .cpp and .h file? 是否可以开发具有多个接口(小部件)的应用程序,其中每个小部件都具有自己的.cpp和.h文件? If so, can you suggest a way to do that? 如果是这样,您能建议一种方法吗?

I am aware of the stacked widget way but this method doesn't allow me to separate the code of each page from the others. 我知道堆叠式小部件的方式,但是这种方法不允许我将每个页面的代码与其他页面分开。

I need to have the general structure of my application to be similar to an android application developed in Eclipse. 我需要使我的应用程序具有与在Eclipse中开发的android应用程序相似的一般结构。

You can create widgets separately, then, dynamically construct QStackedWidget and add widgets to it using addWidget method 您可以分别创建小部件,然后动态构造QStackedWidget并使用addWidget方法QStackedWidget添加小部件

PS. PS。 you can also use widget promotion, to have QStackedWidget be created by QtDesigner and filled with your widgets http://doc.qt.digia.com/stable/designer-using-custom-widgets.html 您还可以使用小部件升级,以使QStackedWidget创建QStackedWidget并用小部件填充http://doc.qt.digia.com/stable/designer-using-custom-widgets.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM