Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt - setupUi( ) [duplicate]

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 at the end?

Thanks.

like image 628
Simplicity Avatar asked Apr 17 '11 10:04

Simplicity


1 Answers

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);
...
like image 182
Barbaris Avatar answered Nov 18 '22 22:11

Barbaris