您的位置:首页 > 产品设计 > UI/UE

QT 012 [深入] Qt setupUi函数的原理和实现

2017-07-20 15:36 120 查看

1 度娘:

setupUi(this)是由.ui文件生成的类的构造函数,这个函数的作用是对界面进行初始化,它按照我们在Qt设计器里设计的样子把窗体画出来,把我们在Qt设计器里面定义的信号和槽建立起来。也可以说,setupUi 是我们画界面和写程序之间的桥梁。

2 stackoverflow

setupUi() creates the actual instances of widgets for you. A form that you create in QtDesigner is stored just as XML file. So to be able to build the actual "window" with all the elements that you put on it in QtDesigner and display it in your application,
setupUi() is created for you automatically by UIC (UI compiler - a Qt tool) so you don't have to do that manually. All the properties that you set in QtDesigner and all elements you put there will be "translated" in C++ code like this:

QLabel *label1 = new QLabel(tr("Start"), this);

QTableView *view1 = new QTableView(this);

...

3 实际应用:

REF:

1 Qt中Ui名字空间以及setupUi函数的原理和实现
http://blog.csdn.net/songjinshi/article/details/7333119
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: