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=0) |
| | Initializes the SiSpinBox internals.
|
| |
| | SiSpinBox (Unit unit, QWidget *parent=0) |
| | Initializes the SiSpinBox, allowing the user to choose the unit.
|
| |
|
| ~SiSpinBox () |
| | Cleans up the main window.
|
| |
| QValidator::State | validate (QString &input, int &pos) const |
| | Validates the text after user input.
|
| |
| double | valueFromText (const QString &text) const |
| | Parse value from input text.
|
| |
| QString | textFromValue (double val) const |
| | Get string representation of value.
|
| |
| void | fixup (QString &input) const |
| | Fixes the text after the user finished changing it.
|
| |
| void | stepBy (int steps) |
| | 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.
|
| |
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 = 0 | ) |
|
|
explicit |
Initializes the SiSpinBox internals.
- Parameters
-
◆ SiSpinBox() [2/2]
| SiSpinBox::SiSpinBox |
( |
Unit | unit, |
|
|
QWidget * | parent = 0 ) |
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. |
◆ fixup()
| void SiSpinBox::fixup |
( |
QString & | input | ) |
const |
Fixes the text after the user finished changing it.
- Parameters
-
| input | The content of the text box. |
◆ setMode()
| void SiSpinBox::setMode |
( |
const int | mode | ) |
|
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 > & | steps | ) |
|
Set the steps the spin box will take.
- Parameters
-
| steps | The steps, will be extended with the ratio from the start after the last element. |
◆ setUnit()
| bool SiSpinBox::setUnit |
( |
Unit | unit | ) |
|
Set the unit for this spin box.
- Parameters
-
| unit | 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 | steps | ) |
|
Increase/decrease the values in fixed steps.
- Parameters
-
| steps | The number of steps, positive means increase. |
◆ textFromValue()
| QString SiSpinBox::textFromValue |
( |
double | val | ) |
const |
Get string representation of value.
- Parameters
-
- Returns
- String representation containing value and (prefix+)unit.
◆ validate()
| QValidator::State SiSpinBox::validate |
( |
QString & | input, |
|
|
int & | pos ) const |
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 |
Parse value from input text.
- Parameters
-
| text | The content of the text box. |
- Returns
- Value in base unit.
The documentation for this class was generated from the following files: