From edb85f980ced8369de4e1cdbf4ba463a1bec2408 Mon Sep 17 00:00:00 2001 From: Swiftb0y <12380386+Swiftb0y@users.noreply.github.com> Date: Fri, 8 Nov 2024 22:37:44 +0100 Subject: [PATCH] fixup! refactor: slim down valuetransformer.h and auto memory management --- src/util/valuetransformer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/valuetransformer.cpp b/src/util/valuetransformer.cpp index 71029e7382c7..f328ce404a98 100644 --- a/src/util/valuetransformer.cpp +++ b/src/util/valuetransformer.cpp @@ -93,7 +93,7 @@ double ValueTransformer::transform(double argument) const { m_transformers.cend(), argument, [&](double argument, const auto& pNode) { - return pNode->transformInverse(argument); + return pNode->transform(argument); }); } @@ -113,6 +113,7 @@ std::unique_ptr ValueTransformer::parseFromXml( return nullptr; } + // constructor is private, so we can't use std::make_unique auto pTransformer = std::unique_ptr(new ValueTransformer()); auto maybeAddFromElement = [&](auto element) { @@ -134,6 +135,7 @@ std::unique_ptr ValueTransformer::parseFromXml( QDomElement element = node.toElement(); QString name = element.nodeName(); if (name == "Invert") { + pTransformer->addTransformer(std::make_unique()); } else if (name == "Add") { maybeAddFromElement.operator()(element);