If you still want to uncouple the initialization of widgets by derived widgets, you can use "promote to ..." option in Qt designer. Steps:
- class MyTableView : public QTableView {}, and so initialization of table view is moved to the constructor of MyTableView.
- In Qt Designer, open the ui form (MainWidow.ui), and drag and drop a QTableView on it;
- Right mouse click the QTableView, in prompt menu, there's a "promote to" option, open it
- In the dialog of "promoting widget", specify your custom QTableView's class name and header file, say MyTableView, MyTableView.h. This step requires existing custom class and header file.
Borrowed a picture: