The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value.
More...
#include <qgsdoublespinbox.h>
|
void | returnPressed () |
| Emitted when the Return or Enter key is used in the line edit.
|
|
void | textEdited (const QString &text) |
| Emitted when the the value has been manually edited via line edit.
|
|
|
| QgsDoubleSpinBox (QWidget *parent=nullptr) |
| Constructor for QgsDoubleSpinBox.
|
|
void | clear () override |
| Sets the current value to the value defined by the clear value.
|
|
double | clearValue () const |
| Returns the value used when clear() is called.
|
|
bool | expressionsEnabled () const |
| Returns whether the widget will allow entry of simple expressions, which are evaluated and then discarded.
|
|
void | paintEvent (QPaintEvent *e) override |
|
void | setClearValue (double customValue, const QString &clearValueText=QString()) |
| Defines the clear value as a custom value and will automatically set the clear value mode to CustomValue.
|
|
void | setClearValueMode (ClearValueMode mode, const QString &clearValueText=QString()) |
| Defines if the clear value should be the minimum or maximum values of the widget or a custom value.
|
|
void | setExpressionsEnabled (bool enabled) |
| Sets if the widget will allow entry of simple expressions, which are evaluated and then discarded.
|
|
void | setLineEditAlignment (Qt::Alignment alignment) |
| Set alignment in the embedded line edit widget.
|
|
void | setShowClearButton (bool showClearButton) |
| Sets whether the widget will show a clear button.
|
|
void | setSpecialValueText (const QString &txt) |
| Set the special-value text to be txt If set, the spin box will display this text instead of a numeric value whenever the current value is equal to minimum().
|
|
bool | showClearButton () const |
| Returns whether the widget is showing a clear button.
|
|
void | stepBy (int steps) override |
|
QValidator::State | validate (QString &input, int &pos) const override |
|
double | valueFromText (const QString &text) const override |
|
The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value.
The clear value can be either the minimum or the maiximum value of the spin box or a custom value. This value can then be handled by a special value text.
Definition at line 42 of file qgsdoublespinbox.h.
◆ ClearValueMode
Behavior when widget is cleared.
Enumerator |
---|
MinimumValue | Reset value to minimum()
|
MaximumValue | Reset value to maximum()
|
CustomValue | Reset value to custom value (see setClearValue() )
|
Definition at line 62 of file qgsdoublespinbox.h.
◆ QgsDoubleSpinBox()
QgsDoubleSpinBox::QgsDoubleSpinBox |
( |
QWidget * |
parent = nullptr | ) |
|
|
explicit |
◆ changeEvent()
void QgsDoubleSpinBox::changeEvent |
( |
QEvent * |
event | ) |
|
|
overrideprotected |
◆ clear()
void QgsDoubleSpinBox::clear |
( |
| ) |
|
|
override |
Sets the current value to the value defined by the clear value.
Definition at line 138 of file qgsdoublespinbox.cpp.
◆ clearValue()
double QgsDoubleSpinBox::clearValue |
( |
| ) |
const |
◆ expressionsEnabled()
bool QgsDoubleSpinBox::expressionsEnabled |
( |
| ) |
const |
|
inline |
Returns whether the widget will allow entry of simple expressions, which are evaluated and then discarded.
- Returns
true
if spin box allows expression entry
Definition at line 101 of file qgsdoublespinbox.h.
◆ paintEvent()
void QgsDoubleSpinBox::paintEvent |
( |
QPaintEvent * |
e | ) |
|
|
override |
◆ returnPressed
void QgsDoubleSpinBox::returnPressed |
( |
| ) |
|
|
signal |
Emitted when the Return or Enter key is used in the line edit.
- Since
- QGIS 3.40
◆ setClearValue()
void QgsDoubleSpinBox::setClearValue |
( |
double |
customValue, |
|
|
const QString & |
clearValueText = QString() |
|
) |
| |
Defines the clear value as a custom value and will automatically set the clear value mode to CustomValue.
- Parameters
-
customValue | defines the numerical value used as the clear value |
clearValueText | is the text displayed when the spin box is at the clear value. If not specified, no special value text is used. |
- See also
- clearValue()
Definition at line 145 of file qgsdoublespinbox.cpp.
◆ setClearValueMode()
Defines if the clear value should be the minimum or maximum values of the widget or a custom value.
- Parameters
-
mode | mode to user for clear value |
clearValueText | is the text displayed when the spin box is at the clear value. If not specified, no special value text is used. |
Definition at line 164 of file qgsdoublespinbox.cpp.
◆ setExpressionsEnabled()
void QgsDoubleSpinBox::setExpressionsEnabled |
( |
bool |
enabled | ) |
|
Sets if the widget will allow entry of simple expressions, which are evaluated and then discarded.
- Parameters
-
enabled | set to true to allow expression entry |
Definition at line 63 of file qgsdoublespinbox.cpp.
◆ setLineEditAlignment()
void QgsDoubleSpinBox::setLineEditAlignment |
( |
Qt::Alignment |
alignment | ) |
|
◆ setShowClearButton()
void QgsDoubleSpinBox::setShowClearButton |
( |
bool |
showClearButton | ) |
|
Sets whether the widget will show a clear button.
The clear button allows users to reset the widget to a default or empty state.
- Parameters
-
showClearButton | set to true to show the clear button, or false to hide it |
- See also
- showClearButton()
Definition at line 57 of file qgsdoublespinbox.cpp.
◆ setSpecialValueText()
void QgsDoubleSpinBox::setSpecialValueText |
( |
const QString & |
txt | ) |
|
Set the special-value text to be txt If set, the spin box will display this text instead of a numeric value whenever the current value is equal to minimum().
Typical use is to indicate that this choice has a special (default) meaning.
Definition at line 198 of file qgsdoublespinbox.cpp.
◆ showClearButton()
bool QgsDoubleSpinBox::showClearButton |
( |
| ) |
const |
|
inline |
◆ stepBy()
void QgsDoubleSpinBox::stepBy |
( |
int |
steps | ) |
|
|
override |
◆ textEdited
void QgsDoubleSpinBox::textEdited |
( |
const QString & |
text | ) |
|
|
signal |
Emitted when the the value has been manually edited via line edit.
- Since
- QGIS 3.40
◆ timerEvent()
void QgsDoubleSpinBox::timerEvent |
( |
QTimerEvent * |
event | ) |
|
|
overrideprotected |
◆ validate()
QValidator::State QgsDoubleSpinBox::validate |
( |
QString & |
input, |
|
|
int & |
pos |
|
) |
| const |
|
override |
◆ valueFromText()
double QgsDoubleSpinBox::valueFromText |
( |
const QString & |
text | ) |
const |
|
override |
◆ wheelEvent()
void QgsDoubleSpinBox::wheelEvent |
( |
QWheelEvent * |
event | ) |
|
|
overrideprotected |
◆ TestQgsRangeWidgetWrapper
friend class TestQgsRangeWidgetWrapper |
|
friend |
◆ clearValue
bool QgsDoubleSpinBox::clearValue |
|
readwrite |
◆ expressionsEnabled
bool QgsDoubleSpinBox::expressionsEnabled |
|
readwrite |
◆ showClearButton
bool QgsDoubleSpinBox::showClearButton |
|
readwrite |
The documentation for this class was generated from the following files: