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开发者_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);
...
精彩评论