вот что я нагородил
void MainForm::readSettings()
{
//restoreState();
QSettings settings(QCoreApplication::organizationName(), QCoreApplication::applicationName());
const QByteArray geometry = settings.value("geometry", QByteArray()).toByteArray();
//const QByteArray dock = settings.value("dockwidget", QByteArray()).toByteArray();
const QByteArray mainWin = settings.value("mainwindow", QByteArray()).toByteArray();
QMainWindow::restoreState(mainWin);
/*dockData*/
/*statCompareView*/
settings.beginGroup("dockWidget");
/**/settings.beginGroup("comparableviewer");
/**//**/statCompareView->setVisible(settings.value("visible", true).toBool());
/**//**/statCompareView->restoreGeometry(settings.value("geometry", QByteArray()).toByteArray());
/**/settings.endGroup();
/**/settings.beginGroup("treeview");
/**//**/dockData->setVisible(settings.value("visible", true).toBool());
/**//**/dockData->restoreGeometry(settings.value("geometry", QByteArray()).toByteArray());
/**/settings.endGroup();
//
settings.endGroup();
QPoint pos = settings.value("pos", QPoint(100, 100)).toPoint();
if (geometry.isEmpty()) {
const QRect availableGeometry = QApplication::desktop()->availableGeometry(this);
resize(1200, 700);
move(200, 200);
}
else {
restoreGeometry(geometry);
}
}
void MainForm::writeSettigs()
{
QSettings settings(QCoreApplication::organizationName(), QCoreApplication::applicationName());
settings.setValue("geometry", saveGeometry());
settings.setValue("mainwindow", QMainWindow::saveState());
settings.beginGroup("dockWidget");
/**/settings.beginGroup("comparableviewer");
/**//**/settings.setValue("visible", statCompareView->isVisible());
/**//**/settings.setValue("geometry", statCompareView->saveGeometry());
/**/settings.endGroup();
/**/settings.beginGroup("treeview");
/**//**/settings.setValue("visible", dockData->isVisible());
/**//**/settings.setValue("geometry", dockData->saveGeometry());
/**/settings.endGroup();
settings.endGroup();
}