diff --git a/src/base/settingsstorage.h b/src/base/settingsstorage.h index 500398a2a..524f87170 100644 --- a/src/base/settingsstorage.h +++ b/src/base/settingsstorage.h @@ -60,17 +60,18 @@ public: { if constexpr (std::is_enum_v) { - const auto value = loadValueImpl(key).toString(); + const auto value = loadValue(key); return Utils::String::toEnum(value, defaultValue); } - else if constexpr (std::is_same_v) + else if constexpr (IsQFlags::value) { - return loadValueImpl(key, defaultValue); + const typename T::Int value = loadValue(key, static_cast(defaultValue)); + return T {value}; } - else if constexpr (IsQFlags::value) + else if constexpr (std::is_same_v) { - const QVariant value = loadValueImpl(key, static_cast(defaultValue)); - return T {value.template value()}; + // fast path for loading QVariant + return loadValueImpl(key, defaultValue); } else {