if( QMessageBox::question(this, qApp
->applicationName
(),
tr("You are about to reset <strong>all</strong> of your user settings. Are you sure that this is what you want?"),
// Clear all the user settings and restart <APP> (indeed, a restart
// will ensure that the various dock windows are, for instance, properly
// reset with regards to their dimensions)
// Restart <APP>, but without providing any of the argument with which
// <APP> was originally started, since we indeed want to reset
// everything
qApp->applicationDirPath());
// Quit <APP>
// Note: the closeEvent method won't get called and this is exactly what
// we want, since we don't want to save <APP>'s settings
qApp->quit();
}
if( QMessageBox::question(this, qApp->applicationName(),
tr("You are about to reset <strong>all</strong> of your user settings. Are you sure that this is what you want?"),
QMessageBox::Yes|QMessageBox::No,
QMessageBox::Yes) == QMessageBox::Yes ) {
// Clear all the user settings and restart <APP> (indeed, a restart
// will ensure that the various dock windows are, for instance, properly
// reset with regards to their dimensions)
QSettings(qApp->applicationName()).clear();
// Restart <APP>, but without providing any of the argument with which
// <APP> was originally started, since we indeed want to reset
// everything
QProcess::startDetached(qApp->applicationFilePath(), QStringList(),
qApp->applicationDirPath());
// Quit <APP>
// Note: the closeEvent method won't get called and this is exactly what
// we want, since we don't want to save <APP>'s settings
qApp->quit();
}
To copy to clipboard, switch view to plain text mode
Bookmarks