Adding a widget to a QFrame
I have a QMainWindow which has a QFrame(object name: navigationFrame) and I struggling to figure out a way to add a user widget(navigationWidget) onto this frame programmatically.
Is there a way to do it?
I tried the following:
Also, what is the recommended practice when adding user defined widgets within a form?
bq. Is there a way to do it?
If the main window is the standard main window created by the wizard and the navigationForm was added in the designer then you can access it through the ui member of the main window class, e.g.:
auto layout = new QVBoxLayout();
bq. Also, what is the recommended practice when adding user defined widgets within a form?
You place a "dummy" plain widget (or the base class of your custom widget) in the editor and then "promote it":http://doc.qt.io/qt-5/designer-using-custom-widgets.html#promoting-widgets to your custom class.