From 801125d87a83f3128cee5db5a340b5499f945542 Mon Sep 17 00:00:00 2001 From: AdenKoperczak Date: Fri, 26 Jul 2024 11:42:48 -0400 Subject: [PATCH] changed unitAbbreviation_ over to not use pointers --- .../source/scwx/qt/settings/settings_interface.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scwx-qt/source/scwx/qt/settings/settings_interface.cpp b/scwx-qt/source/scwx/qt/settings/settings_interface.cpp index dd85595e..9a24c5ae 100644 --- a/scwx-qt/source/scwx/qt/settings/settings_interface.cpp +++ b/scwx-qt/source/scwx/qt/settings/settings_interface.cpp @@ -55,9 +55,9 @@ public: std::function mapFromValue_ {nullptr}; std::function mapToValue_ {nullptr}; - double unitScale_ {1}; - const std::string * unitAbbreviation_ {nullptr}; - bool unitEnabled_ {false}; + double unitScale_ {1}; + std::optional unitAbbreviation_ {}; + bool unitEnabled_ {false}; }; template @@ -483,9 +483,9 @@ template void SettingsInterface::SetUnit(const double& scale, const std::string& abbreviation) { - p->unitScale_ = scale; - p->unitAbbreviation_ = &abbreviation; - p->unitEnabled_ = true; + p->unitScale_ = scale; + p->unitAbbreviation_ = abbreviation; + p->unitEnabled_ = true; p->UpdateEditWidget(); p->UpdateUnitLabel(); } @@ -604,7 +604,7 @@ void SettingsInterface::Impl::UpdateUnitLabel() return; } - unitLabel_->setText(QString::fromStdString(*unitAbbreviation_)); + unitLabel_->setText(QString::fromStdString(unitAbbreviation_.value_or(""))); } template