void MainWindow::showEvent(QShowEvent * event) {
restoreGeometry(_config->IniRead(QStringLiteral("MainWindow/geometry")).toByteArray()); // 读取位置
restoreState(_config->IniRead(QStringLiteral("MainWindow/state")).toByteArray()); // 读取状态
}
void MainWindow::closeEvent(QCloseEvent * event) {
_config->IniWrite(QStringLiteral("MainWindow/geometry"), saveGeometry()); // 记住位置
_config->IniWrite(QStringLiteral("MainWindow/state"), saveState()); // 记住状态
}
PS: _config是配置文件读写类