Ui命名空间中的Qt小部件项目 [英] Ui namespace in Qt widget projects

查看:169
本文介绍了Ui命名空间中的Qt小部件项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为SeasonCreator的Qt小部件项目,并且想知道一个Qt小部件项目的结构。

I have a Qt widget project called "SeasonCreator" and am wondering about the structure of a Qt widget project.

ui_seasoncreator.h文件被隐藏,你看看它,它定义了一个名为Ui的命名空间,它是一个类SeasonCreator的声明,继承自Ui_SeasonCreator,它是c。

The ui_seasoncreator.h file is hidden, but when you look into it, it defines a namespace called "Ui" and in it is a declaration of a class SeasonCreator, which inherits from Ui_SeasonCreator, which is the c.

seasoncreator.h文件,还有一个名为Ui的命名空间,还有一个称为SeasonCreator的类的声明。当我点击找到它的原始声明,它导致我在ui_seasoncreator.h文件中的Ui :: SeasonCreator的声明。

In the seasoncreator.h file, there is also a namespace called "Ui" also with a declaration of a class called "SeasonCreator". When I click to find its original declaration it leads me to the declaration of Ui::SeasonCreator in the ui_seasoncreator.h file.

这些命名空间和类?这两个定义是否相关?

这些Ui :: SeasonCreator声明与seasoncreator.h中的自定义SeasonCreator类有关

Do any of these Ui::SeasonCreator declarations have anything to do with the custom SeasonCreator class in seasoncreator.h?

推荐答案


这些命名空间和类的用途是什么?

What is the purpose for these namespace and classes?

ui_XXX.h中的代码是在使用designer创建表单时为您自动生成的代码。



The code in ui_XXX.h is code that is automatically generated for you when you use designer to create a form. It's put into the Ui namespace.


这两个定义是否相关?

Do the two definitions relate?

我假设你指的是这样的东西:

I'm assuming you're referring to something that looks like this:

namespace Ui { class SeasonCreator; }

这是向类声明的类,它是生成的代码的一部分,

which is a forward declaration of the class that is part of the generated code that gives your class access to the widgets in your custom form.


做任何这些Ui :: SeasonCreator声明与季节创建器中的自定义SeasonCreator类有任何关系.h?

Do any of these Ui::SeasonCreator declarations have anything to do with the custom SeasonCreator class in seasoncreator.h?

这是将您的自定义代码与生成的代码链接在一起的。你应该可以有你的自定义类的成员变量 Ui :: SeasonCreator * ui ,这是你用来访问生成的Ui类的对象。

It's what links your custom code together with the generated code. You should probably have a member variable of your custom class called Ui::SeasonCreator *ui, which is the object you use to access the generated Ui classes.

这篇关于Ui命名空间中的Qt小部件项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆