I finally figured it out, it is easy, but I have missed it on the first time
for those who are interested:
1) Create QDockWidgets and QToolbars desired.
2) Assign each of them an unique objectName.
3) Call QMainWindow::restoreState( const QByteArray & array ).
In the destructor, call QByteArray QMainWindow::saveState();
The QByteArray could be stored in QSettings, regular file, etc.