19namespace MantidWidgets {
20namespace QSettingsHelper {
29template <
typename T> T
getSetting(std::string
const &settingGroup, std::string
const &settingName) {
31 settings.beginGroup(QString::fromStdString(settingGroup));
32 auto const settingValue = settings.value(QString::fromStdString(settingName));
35 return settingValue.value<T>();
45template <
typename T> std::map<std::string, T>
getSettingsAsMap(std::string
const &settingGroup) {
46 std::map<std::string, T> settingsMap;
48 settings.beginGroup(QString::fromStdString(settingGroup));
49 QStringList settingNames = settings.allKeys();
50 std::string templateTypeName =
typeid(T).name();
51 for (
auto &settingName : settingNames) {
52 if (settingName.endsWith(
"/type")) {
53 std::string settingTypeName = settings.value(settingName).toString().toStdString();
54 if (settingTypeName == templateTypeName) {
55 auto settingValueName = settingName.replace(QString(
"/type"), QString(
"/value"));
56 auto setting = settings.value(settingValueName);
57 auto strippedSettingName = settingName.remove(QString(
"/value"));
58 settingsMap[strippedSettingName.toStdString()] = setting.value<T>();
75template <
typename T>
void setSetting(std::string
const &settingGroup, std::string
const &settingName, T
const &
value) {
77 settings.beginGroup(QString::fromStdString(settingGroup));
78 settings.setValue(QString::fromStdString(settingName).append(
"/value"),
value);
79 settings.setValue(QString::fromStdString(settingName).append(
"/type"),
typeid(
value).name());
double value
The value of the point.
The AlgorithmProgressDialogPresenter keeps track of the running algorithms and displays a progress ba...