Reputation: 1332
in Qt i add a form according below
1. Add New
2. Qt Designer Form (not Qt Designer Form Class)
3. Then type name and Ok
this will create a form.
my questions are ..
how can i add this form to my class (having cpp and hpp but not gui file) ?
will it behave like Qt Designer Class form ?
can i share same form in multiple classes ( having hpp and cpp file only) ?
Upvotes: 0
Views: 204
Reputation: 2790
In Qt there is no really form class. The .ui file is an XML file that describes what widgets should be automatically created in generated ui_classname.h file. Just take a look at that file.
Main work is done in setupUi()
method:
void setupUi(QWidget* a) {
if (a->objectName().isEmpty())
a->setObjectName(QString::fromUtf8("QBottomControl"));
a->resize(1024, 113);
a->setMinimumSize(QSize(1024, 113));
a->setWindowTitle(QString::fromUtf8("QBottomControl"));
...
}
If you don't want to use the Designer, then you can manually create this initializations like it is done in setupUi() method.
Upvotes: 1