Custom SpinBox The DoubleSpinBox internally uses a QDoubleSpinBox while it retain controls over it.
More...
#include <doubleSpinBox.h>
|
enum | SetMode { SetAlways
, SetIfDifferent
} |
|
enum | DecimalsOption {
FixedDecimals = 0x000
, DecimalsByShortcuts = 0x001
, DecimalsByKey = 0x002
, DecimalsByValue = 0x004
,
InsertDecimals = 0x008
, ReplaceDecimals = 0x010
, DecimalsAsMax = 0x020
, DecimalsAsMin = 0x040
,
DecimalPointAlwaysVisible = 0x080
} |
|
enum | SizeHintPolicy { SizeHintByMinMax
, SizeHintByValue
} |
|
typedef QWidget | Superclass |
|
|
void | valueChanged (double) |
|
void | valueChanged (const QString &) |
|
void | editingFinished () |
|
void | decimalsChanged (int) |
| Signal emitted when the decimals of the displayed are changed.
|
|
|
virtual void | keyPressEvent (QKeyEvent *event) |
| Reimplemented to support shortcuts.
|
|
virtual bool | eventFilter (QObject *obj, QEvent *event) |
| Reimplemented to support shortcuts on the double spinbox.
|
|
|
class | CoordinatesWidgetPrivate |
|
Custom SpinBox The DoubleSpinBox internally uses a QDoubleSpinBox while it retain controls over it.
- See also
- DoubleSlider, SliderWidget, RangeSlider
◆ DecimalsOption
DecimalsOption enums the input style of the spinbox decimals. Default option is DecimalsByShortcuts.
- See also
- decimals(), currentDecimals()
Enumerator |
---|
FixedDecimals | Behaves just like a QDoubleSpinBox. The maximum number of decimals allowed is given by decimals().
|
DecimalsByShortcuts | When the spinbox has focus, entering the shortcut "CTRL +" adds decimals to the current number of decimals. "CTRL -" decreases the number of decimals and "CTRL 0" returns it to its original decimals() value.
|
DecimalsByKey | Allow the number of decimals to be controlled by adding/removing digits with key strokes. - See also
- InsertDecimals, ReplaceDecimals
|
DecimalsByValue | Allow the number of decimals to be controlled by the value set by setValue().
|
InsertDecimals | This flag controls whether inserted intermediate decimals increase the number of decimals (on) or not (off). It is incompatible with the ReplaceDecimals flag. - See also
- DecimalsByKey.
|
ReplaceDecimals | This flag controls whether inserted intermediate decimals replace the existing decimals (on) or not (off). This is similar to Insert but just for decimal digits. It is incompatible with the InsertDecimals flag. - See also
- DecimalsByKey, InsertDecimals
|
DecimalsAsMax | Use the "decimals" property as a maximum limit for the number of decimals.
|
DecimalsAsMin | Use the "decimals" property as a minimum limit for the number of decimals.
|
DecimalPointAlwaysVisible | Even if the number of decimals is 0, it enforces the decimal to be visible (e.g. "0." ) - See also
- decimals
|
◆ SetMode
SetMode enums for the spinbox behavior. SetAlways: No check is made and the given parameters is directly set on the internal QDoubleSpinBox. SetIfDifferent: Default mode, the given parameter is checked against the current internal value and only set if they are different. For double, the comparison is based on the input parameters rounded with the current number of decimals (see round()).
- See also
- setMode(), setSetMode(), round()
◆ DoubleSpinBox()
DoubleSpinBox::DoubleSpinBox |
( |
QWidget * | parent = 0 | ) |
|
|
explicit |
Constructor, creates a DoubleSpinBox. The look and feel are the same as of a QDoubleSpinBox
◆ cleanText()
QString DoubleSpinBox::cleanText |
( |
| ) |
const |
Get the spinbox current text. This excludes any prefix or suffix.
- See also
- value()
◆ decimals()
int DoubleSpinBox::decimals |
( |
| ) |
const |
◆ decimalsOption()
DoubleSpinBox::DecimalsOptions DoubleSpinBox::decimalsOption |
( |
| ) |
|
◆ displayedValue()
double DoubleSpinBox::displayedValue |
( |
| ) |
const |
◆ editingFinished
void DoubleSpinBox::editingFinished |
( |
| ) |
|
|
signal |
Simple broadcast of the QAbstractSpinbox::editingFinished
- See also
- QAbstractSpinbox::editingFinished
◆ lineEdit()
QLineEdit * DoubleSpinBox::lineEdit |
( |
| ) |
const |
Get a pointer on the line edit of the spinbox.
- See also
- QLineEdit, spinBox()
◆ minimumSizeHint()
QSize DoubleSpinBox::minimumSizeHint |
( |
| ) |
const |
|
virtual |
Reimplemented to respect the sizeHintPolicy property value.
- See also
- sizeHintPolicy
◆ prefix()
QString DoubleSpinBox::prefix |
( |
| ) |
const |
Add/Get a prefix to the displayed value. For example, one might want to add the $ sign.
- See also
- suffix(), text()
◆ round()
double DoubleSpinBox::round |
( |
double | value | ) |
const |
Returns the rounded value according to the number of decimals of the spinbox.
- See also
- decimals()
◆ setDecimals
void DoubleSpinBox::setDecimals |
( |
int | decimal | ) |
|
|
slot |
Set the decimals property value.
- See also
- decimals
◆ setDisplayedValue()
void DoubleSpinBox::setDisplayedValue |
( |
double | displayValue | ) |
|
Set the displayed value if there is no proxy installed. If there is a proxy installed, then it allows to modify the proxy value. If there is no value proxy installed, then it's just a setter to the value property.
- See also
- displayedValue(), setValue(), value(), setValueProxy()
◆ setInvertedControls()
void DoubleSpinBox::setInvertedControls |
( |
bool | invertedControls | ) |
|
This property holds whether or not the spin box inverts its wheel and key events. If this property is false, scrolling the mouse wheel "up" and using keys like page up will increase the spinbox's value towards its maximum. Otherwise pressing page up will move value towards the slider's minimum.
◆ setMode()
◆ setPrefix()
void DoubleSpinBox::setPrefix |
( |
const QString & | prefix | ) |
|
◆ setSizeHintPolicy()
void DoubleSpinBox::setSizeHintPolicy |
( |
DoubleSpinBox::SizeHintPolicy | newSizeHintPolicy | ) |
|
◆ setSuffix()
void DoubleSpinBox::setSuffix |
( |
const QString & | suffix | ) |
|
◆ setValue
void DoubleSpinBox::setValue |
( |
double | value | ) |
|
|
slot |
◆ setValueAlways
void DoubleSpinBox::setValueAlways |
( |
double | value | ) |
|
|
slot |
◆ setValueIfDifferent
void DoubleSpinBox::setValueIfDifferent |
( |
double | value | ) |
|
|
slot |
◆ setValueProxy()
void DoubleSpinBox::setValueProxy |
( |
ValueProxy * | proxy | ) |
|
Install or remove a value proxy filter. The value proxy decouples the displayed value from the value retrieved by the value property. For example, the value proxy can allow one to display celsius in the spinbox while the value retrieved from the value property and signals are in fahrenheit. To remove the proxy, simply install a new empty proxy. The proxy installation/removal is silent.
- See also
- installValueProxy(), valueProxy()
◆ singleStep()
double DoubleSpinBox::singleStep |
( |
| ) |
const |
Set/Get the single step. This represents by how much the value will decrease or increase when clicking the spinbox arrow or using stepUp or stepDown(). Default is 1.0.
- See also
- setUp(), stepDown(), setDecimals().
◆ sizeHint()
QSize DoubleSpinBox::sizeHint |
( |
| ) |
const |
|
virtual |
Reimplemented to respect the sizeHintPolicy property value.
- See also
- sizeHintPolicy
◆ sizeHintPolicy()
DoubleSpinBox::SizeHintPolicy DoubleSpinBox::sizeHintPolicy |
( |
| ) |
const |
◆ spinBox()
QDoubleSpinBox * DoubleSpinBox::spinBox |
( |
| ) |
const |
Get a pointer on the spinbox used internally. It can be useful to change display properties for example. To use with caution.
- See also
- QDoubleSpinBox, lineEdit()
◆ stepUp
void DoubleSpinBox::stepUp |
( |
| ) |
|
|
slot |
Increase/Decrease the current value by a single step.
- See also
- value(), singleStep()
◆ suffix()
QString DoubleSpinBox::suffix |
( |
| ) |
const |
Add/Get a suffix to the displayed value. For example, one might want to add the F (fahrenheit) sign.
- See also
- prefix(), text()
◆ text()
QString DoubleSpinBox::text |
( |
| ) |
const |
Get the spinbox current text. This includes any prefix or suffix.
- See also
- prefix(), suffix()
◆ value()
double DoubleSpinBox::value |
( |
| ) |
const |
Get the spinbox current value
- See also
- setValue(), cleanText()
◆ valueChanged
void DoubleSpinBox::valueChanged |
( |
double | | ) |
|
|
signal |
Emitted every time the spinbox value is modified
- See also
- QDoubleSpinBox::valueChanged()
◆ decimals
int DoubleSpinBox::decimals |
|
readwrite |
This property holds the precision of the spin box, in decimals. Sets how many decimals the spinbox will use for displaying and interpreting doubles. If the flag DecimalsByShortcuts is set, decimals can be increased/decreased by Ctrl+/Ctrl-, Ctrl0 restores the original decimals value. If the flag DecimalsAsMax and/or DecimalsAsMin are set, decimals behave also as the max and/or min number of decimals settable by DecimalsByShortcuts, DecimalsByKey and DecimalsByValue. 2 by default.
- See also
- decimalsOption, decimals(), setDecimals(), decimalsChanged
◆ decimalsOption
DoubleSpinBox::DecimalsOptions DoubleSpinBox::decimalsOption |
|
readwrite |
This property provides more controls over the decimals. The default (DecimalsByShortcuts|InsertDecimals) behaves as a QDoubleSpinbox with an explicit control of decimals via shortcuts.
- See also
- DecimalsOptions, decimals
◆ invertedControls
bool DoubleSpinBox::invertedControls |
|
readwrite |
This property controls whether decreasing the value by the mouse button or mouse wheel increases the value of the widget, and inverts the control similarly in the other way round or not. The property is switched off by default.
- See also
- invertedControls(), setInvertedControls()
◆ setMode
◆ sizeHintPolicy
SizeHintPolicy DoubleSpinBox::sizeHintPolicy |
|
readwrite |
◆ value
double DoubleSpinBox::value |
|
readwrite |
The documentation for this class was generated from the following files:
- C:/Workspace/itom_development_VS2019_Qt5.15.2_x64/itomProject/itom/itomWidgets/doubleSpinBox.h
- C:/Workspace/itom_development_VS2019_Qt5.15.2_x64/itomProject/itom/itomWidgets/doubleSpinBox.cpp