I have created a traditional Qt (widget based) GUI, something like this: MainWindow::MainWindow(parent) : QMainWindow(parent)
This is designed by Qt Creator as forms (mainwindow.ui
), aka Design Mode
. Everything works fine. But the GUI code with all widgets, initializing the corresponding models, and functionality gets quit long. I'd like to refactor to small units. Things I came up with:
- I tried using specialized (derived) widgets. Example: A created
MyTableView::QTableView
contains the specialized model, as well the signal/slot handling between model and widget. This reduces the amount of code inMainWindow
. However, I do loose the capability to design the GUI via Qt Creator'sDesign mode
. - The best thing I came up with so far, was to spilt the source code (multiple
cpp
files). It still represents one class, but less code in one file.
So, how could I better partition my GUI class?