![]() |
Workspace 6.21.5
|
Spin box designed for easy unit conversions in the GUI. More...
#include <ApplicationSupport/Widgets/conversionspinbox.h>
Inherits QDoubleSpinBox.
Public Slots | |
void | toggleSecondaryMode (bool toggle) |
Public Member Functions | |
ConversionSpinBox (QWidget *parent=nullptr) | |
double | getConversionFactor () const |
double | getPrimaryValue () const |
int | getSecondaryDecimals () const |
double | getSecondaryMaximum () const |
double | getSecondaryMinimum () const |
QString | getSecondaryPrefix () const |
double | getSecondarySingleStep () const |
QString | getSecondarySuffix () const |
void | setConversionFactor (double factor) |
void | setSecondaryDecimals (int decimals) |
void | setSecondaryMaximum (double maximum) |
void | setSecondaryMinimum (double minimum) |
void | setSecondaryPrefix (const QString &prefix) |
void | setSecondarySingleStep (double step) |
void | setSecondarySuffix (const QString &suffix) |
void | setValueAsPrimary (double value) |
Properties | |
double | conversionFactor |
int | secondaryDecimals |
double | secondaryMaximum |
double | secondaryMinimum |
QString | secondaryPrefix |
double | secondarySingleStep |
QString | secondarySuffix |
This spin box is intended to allow an easy way to perform unit conversions (or unit scaling) at the GUI layer. The unit conversion does not affect the workflow that interfaces with the spin box. Any workflow attached to this spin box always interfaces by the 'primary' unit type. This functionality is achieved by exposing a secondary set of properties with a conversion factor to perform conversions from/to the primary properties. Slots are exposed to activate the conversion operation.
As an example, a workflow can internally perform calculations based on metric units while a user can blissfully enter/view inputs/outputs in Imperial units.
ConversionSpinBox | ( | QWidget * | parent = nullptr | ) |
double getConversionFactor | ( | ) | const |
double getPrimaryValue | ( | ) | const |
int getSecondaryDecimals | ( | ) | const |
double getSecondaryMaximum | ( | ) | const |
double getSecondaryMinimum | ( | ) | const |
QString getSecondaryPrefix | ( | ) | const |
double getSecondarySingleStep | ( | ) | const |
QString getSecondarySuffix | ( | ) | const |
void setConversionFactor | ( | double | factor | ) |
void setSecondaryDecimals | ( | int | decimals | ) |
void setSecondaryMaximum | ( | double | maximum | ) |
void setSecondaryMinimum | ( | double | minimum | ) |
void setSecondaryPrefix | ( | const QString & | prefix | ) |
void setSecondarySingleStep | ( | double | step | ) |
void setSecondarySuffix | ( | const QString & | suffix | ) |
void setValueAsPrimary | ( | double | value | ) |
value | Input value is expected to be in primary units. |
|
slot |
Slot to toggle between the widget's primary and secondary properties. The current value is converted as part of the transition.
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |