A spin box with SI prefix support. This spin box supports the SI prefixes (k/M/G/T) after its value and allows floating point values. The step size is increasing in an exponential way, to keep the percentual difference between the steps at equal levels.
More...
#include <sispinbox.h>
|
| | SiSpinBox (QWidget *parent=nullptr) |
| | Initializes the SiSpinBox internals.
|
| | SiSpinBox (Unit unit, QWidget *parent=nullptr) |
| | Initializes the SiSpinBox, allowing the user to choose the unit.
|
| | ~SiSpinBox () override |
| | Cleans up the main window.
|
| QValidator::State | validate (QString &input, int &pos) const override |
| | Validates the text after user input.
|
| double | valueFromText (const QString &text) const override |
| | Parse value from input text.
|
| QString | textFromValue (double val) const override |
| | Get string representation of value.
|
| void | fixup (QString &input) const override |
| | Fixes the text after the user finished changing it.
|
| void | stepBy (int steps) override |
| | Increase/decrease the values in fixed steps.
|
| bool | setUnit (Unit unit) |
| | Set the unit for this spin box.
|
| void | setUnitPostfix (const QString &postfix) |
| | Set the unit postfix for this spin box.
|
| void | setSteps (const QList< double > &steps) |
| | Set the steps the spin box will take.
|
| void | setMode (const int mode) |
| | Set the mode.
|
|
| void | resetSteppedTo () |
| | Resets the ::steppedTo flag after the value has been changed.
|
|
| Unit | unit |
| | The SI unit used for this spin box.
|
| QString | unitPostfix |
| | Shown after the unit.
|
| QList< double > | steps |
| | The steps, begins from start after last element.
|
| int | mode |
| | The mode, fixed or constant.
|
| bool | steppedTo |
| | true, if the current value was reached using stepBy
|
| int | stepId |
| | The index of the last step reached using stepBy.
|
A spin box with SI prefix support. This spin box supports the SI prefixes (k/M/G/T) after its value and allows floating point values. The step size is increasing in an exponential way, to keep the percentual difference between the steps at equal levels.
◆ SiSpinBox() [1/2]
| SiSpinBox::SiSpinBox |
( |
QWidget * | parent = nullptr | ) |
|
|
explicit |
Initializes the SiSpinBox internals.
- Parameters
-
◆ SiSpinBox() [2/2]
| SiSpinBox::SiSpinBox |
( |
Unit | unit, |
|
|
QWidget * | parent = nullptr ) |
Initializes the SiSpinBox, allowing the user to choose the unit.
- Parameters
-
| unit | The unit shown for the value in the spin box. |
| parent | The parent widget. |
◆ ~SiSpinBox()
| SiSpinBox::~SiSpinBox |
( |
| ) |
|
|
override |
Cleans up the main window.
◆ fixup()
| void SiSpinBox::fixup |
( |
QString & | input | ) |
const |
|
override |
Fixes the text after the user finished changing it.
- Parameters
-
| input | The content of the text box. |
◆ init()
◆ resetSteppedTo
| void SiSpinBox::resetSteppedTo |
( |
| ) |
|
|
privateslot |
Resets the ::steppedTo flag after the value has been changed.
◆ setBackground()
| void SiSpinBox::setBackground |
( |
| ) |
|
|
private |
◆ setMode()
| void SiSpinBox::setMode |
( |
const int | newMode | ) |
|
Set the mode.
- Parameters
-
| mode | The mode, the value 0 will have fixed interval, otherwise the value will have interval within steps itself. |
◆ setSteps()
| void SiSpinBox::setSteps |
( |
const QList< double > & | newSteps | ) |
|
Set the steps the spin box will take.
- Parameters
-
| newSteps | The steps, will be extended with the ratio from the start after the last element. |
◆ setUnit()
| bool SiSpinBox::setUnit |
( |
Unit | newUnit | ) |
|
Set the unit for this spin box.
- Parameters
-
| newUnit | The unit shown for the value in the spin box. |
- Returns
- true on success, false on invalid unit.
◆ setUnitPostfix()
| void SiSpinBox::setUnitPostfix |
( |
const QString & | postfix | ) |
|
Set the unit postfix for this spin box.
- Parameters
-
| postfix | the string shown after the unit in the spin box. |
◆ stepBy()
| void SiSpinBox::stepBy |
( |
int | doStep | ) |
|
|
override |
Increase/decrease the values in fixed steps.
- Parameters
-
| doStep | The number of steps, positive means increase. |
◆ textFromValue()
| QString SiSpinBox::textFromValue |
( |
double | val | ) |
const |
|
override |
Get string representation of value.
- Parameters
-
- Returns
- String representation containing value and (prefix+)unit.
◆ validate()
| QValidator::State SiSpinBox::validate |
( |
QString & | input, |
|
|
int & | pos ) const |
|
override |
Validates the text after user input.
- Parameters
-
| input | The content of the text box. |
| pos | The position of the cursor in the text box. |
- Returns
- Validity of the current text.
◆ valueFromText()
| double SiSpinBox::valueFromText |
( |
const QString & | text | ) |
const |
|
override |
Parse value from input text.
- Parameters
-
| text | The content of the text box. |
- Returns
- Value in base unit.
◆ mode
The mode, fixed or constant.
◆ stepId
The index of the last step reached using stepBy.
◆ steppedTo
| bool SiSpinBox::steppedTo |
|
private |
true, if the current value was reached using stepBy
◆ steps
| QList< double > SiSpinBox::steps |
|
private |
The steps, begins from start after last element.
◆ unit
The SI unit used for this spin box.
◆ unitPostfix
| QString SiSpinBox::unitPostfix |
|
private |
The documentation for this class was generated from the following files: