Qt - 初始化窗体 [英] Qt - initializing the form

查看:1472
本文介绍了Qt - 初始化窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们调用 setupUi()时,我们初始化该表单。

When we call setupUi(), we are initializing the form.

初始化是什么意思?如果我们不调用它,会发生什么?

What does initializing the form mean? What happens if we don't call it?

谢谢。

推荐答案

p>当调用setupUi()时,将创建用户在表单上放置的所有UI元素。基本上,UIC工具获取您在Qt Designer中在表单上放置的UI元素的信息,并为您生成这样的代码,所以您不需要手动执行:

When "setupUi()" is called, all the UI elements that the user put on the form are created. Essentially, UIC tool gets information of what UI elements you put on the form in Qt Designer and generates the code like this for you so you don't need to do that manually:

QPushButton *button1 = new QPushButton(parent);
button1->setText(tr("Start"));
...
QTableView *tableView1 = new QTableView(parent);
...

这篇关于Qt - 初始化窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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