added full unit support for radius field, implemented such that future fields needing units can be done easily

This commit is contained in:
AdenKoperczak 2024-07-15 11:33:47 -04:00
parent c53836e91a
commit 146055fb99
7 changed files with 103 additions and 24 deletions

View file

@ -7,6 +7,8 @@
#include <string>
#include <vector>
class QLabel;
namespace scwx
{
namespace qt
@ -91,6 +93,13 @@ public:
*/
void SetResetButton(QAbstractButton* button) override;
/**
* Sets the label for units from the settings dialog.
*
* @param label Unit label
*/
void SetUnitLabel(QLabel* label);
/**
* If the edit widget displays a different value than what is stored in the
* settings variable, a mapping function must be provided in order to convert
@ -109,6 +118,14 @@ public:
*/
void SetMapToValueFunction(std::function<T(const std::string&)> function);
/**
* Sets the unit to be used by this setting.
*
* @param scale The radio of the current unit to the base unit
* @param abbreviation The abreviation to be displayed
*/
void SetUnit(const double& scale, const std::string& abbreviation);
private:
class Impl;
std::unique_ptr<Impl> p;