QGIS API Documentation
3.20.0-Odense (decaadbb31)
|
The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value. More...
#include <qgsspinbox.h>
Public Types | |
enum | ClearValueMode { MinimumValue , MaximumValue , CustomValue } |
Behavior when widget is cleared. More... | |
Public Member Functions | |
QgsSpinBox (QWidget *parent=nullptr) | |
Constructor for QgsSpinBox. More... | |
void | clear () override |
Sets the current value to the value defined by the clear value. More... | |
int | clearValue () const |
Returns the value used when clear() is called. More... | |
bool | expressionsEnabled () const |
Returns whether the widget will allow entry of simple expressions, which are evaluated and then discarded. More... | |
void | setClearValue (int customValue, const QString &clearValueText=QString()) |
Defines the clear value as a custom value and will automatically set the clear value mode to CustomValue. More... | |
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. More... | |
void | setExpressionsEnabled (bool enabled) |
Sets if the widget will allow entry of simple expressions, which are evaluated and then discarded. More... | |
void | setLineEditAlignment (Qt::Alignment alignment) |
Set alignment in the embedded line edit widget. More... | |
void | setShowClearButton (bool showClearButton) |
Sets whether the widget will show a clear button. More... | |
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(). More... | |
bool | showClearButton () const |
Returns whether the widget is showing a clear button. More... | |
QValidator::State | validate (QString &input, int &pos) const override |
int | valueFromText (const QString &text) const override |
Protected Member Functions | |
void | changeEvent (QEvent *event) override |
void | paintEvent (QPaintEvent *event) override |
void | timerEvent (QTimerEvent *event) override |
void | wheelEvent (QWheelEvent *event) override |
Properties | |
bool | clearValue |
bool | expressionsEnabled |
bool | showClearButton |
Friends | |
class | TestQgsRangeWidgetWrapper |
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 qgsspinbox.h.
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 qgsspinbox.h.
|
explicit |
Constructor for QgsSpinBox.
parent | parent widget |
Definition at line 38 of file qgsspinbox.cpp.
|
overrideprotected |
Definition at line 63 of file qgsspinbox.cpp.
|
override |
Sets the current value to the value defined by the clear value.
Definition at line 118 of file qgsspinbox.cpp.
int QgsSpinBox::clearValue | ( | ) | const |
Returns the value used when clear() is called.
Definition at line 153 of file qgsspinbox.cpp.
|
inline |
Returns whether the widget will allow entry of simple expressions, which are evaluated and then discarded.
true
if spin box allows expression entry Definition at line 103 of file qgsspinbox.h.
|
overrideprotected |
Definition at line 75 of file qgsspinbox.cpp.
void QgsSpinBox::setClearValue | ( | int | customValue, |
const QString & | clearValueText = QString() |
||
) |
Defines the clear value as a custom value and will automatically set the clear value mode to CustomValue.
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. |
Definition at line 125 of file qgsspinbox.cpp.
void QgsSpinBox::setClearValueMode | ( | QgsSpinBox::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.
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 139 of file qgsspinbox.cpp.
void QgsSpinBox::setExpressionsEnabled | ( | bool | enabled | ) |
Sets if the widget will allow entry of simple expressions, which are evaluated and then discarded.
enabled | set to true to allow expression entry |
Definition at line 58 of file qgsspinbox.cpp.
void QgsSpinBox::setLineEditAlignment | ( | Qt::Alignment | alignment | ) |
Set alignment in the embedded line edit widget.
alignment |
Definition at line 163 of file qgsspinbox.cpp.
void QgsSpinBox::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.
showClearButton | set to true to show the clear button, or false to hide it |
Definition at line 52 of file qgsspinbox.cpp.
void QgsSpinBox::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 168 of file qgsspinbox.cpp.
|
inline |
Returns whether the widget is showing a clear button.
Definition at line 87 of file qgsspinbox.h.
|
overrideprotected |
Definition at line 102 of file qgsspinbox.cpp.
|
override |
Definition at line 198 of file qgsspinbox.cpp.
|
override |
Definition at line 182 of file qgsspinbox.cpp.
|
overrideprotected |
Definition at line 81 of file qgsspinbox.cpp.
|
friend |
Definition at line 172 of file qgsspinbox.h.
|
readwrite |
Definition at line 1 of file qgsspinbox.h.
|
readwrite |
Definition at line 1 of file qgsspinbox.h.
|
readwrite |
Definition at line 1 of file qgsspinbox.h.