开发者

Qt - setupUi( ) [duplicate]

开发者 https://www.devze.com 2023-02-25 22:29 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: Qt - initializing the form
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Qt - initializing the form

I tried to look for a description for the setupUi() method but couldn't find especially in the Qt documentation.

What does this method do? For example, if I write in a class setupUi(this), what will this do? What does setting up a user interface mean开发者_JS百科 at the end?

Thanks.


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);
...
0

精彩评论

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