What the best way to use the class generated by qt designer?
-
The Direct Approach: you construct a widget to use as a placeholder for the component, and set up the user interface inside it.
The Single Inheritance Approach: you subclass the form's base class (QWidget or QDialog, for example), and include a private instance of the form's user interface object.
The Multiple Inheritance Approach: you subclass both the form's base class and the form's user interface object. This allows the widgets defined in the form to be used directly from within the scope of the subclass.this are the 3 ways to use the file coming out of the qt designer, is there any one better than other? or a particular reason why or when to use one over the other?
thanks guys
-
Hi,
I always create my projects with Qt Creator's new project wizard and go with the default method there which is "Aggregation as a pointer member" (Options > C++ > Qt Class Generation). I think this is best one out of the three because it avoids multiple inheritance and makes it explicit that my class is QWidget, i.e. a UI class.