QGIS API Documentation  2.99.0-Master (7d4f81d)
Public Types | Public Member Functions | Protected Member Functions | Properties | List of all members
QgsDoubleSpinBox Class Reference

The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value. More...

#include <qgsdoublespinbox.h>

Inheritance diagram for QgsDoubleSpinBox:
Inheritance graph
[legend]

Public Types

enum  ClearValueMode { MinimumValue, MaximumValue, CustomValue }
 Behavior when widget is cleared. More...
 

Public Member Functions

 QgsDoubleSpinBox (QWidget *parent=0)
 Constructor for QgsDoubleSpinBox. More...
 
virtual void clear () override
 Set the current value to the value defined by the clear value. More...
 
double 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 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. 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 (const bool enabled)
 Sets if the widget will allow entry of simple expressions, which are evaluated and then discarded. More...
 
void setShowClearButton (const bool showClearButton)
 Sets whether the widget will show a clear button. More...
 
bool showClearButton () const
 Returns whether the widget is showing a clear button. More...
 
virtual QValidator::State validate (QString &input, int &pos) const override
 
virtual double valueFromText (const QString &text) const override
 

Protected Member Functions

virtual void changeEvent (QEvent *event) override
 
void wheelEvent (QWheelEvent *event) override
 

Properties

bool clearValue
 
bool expressionsEnabled
 
bool showClearButton
 

Detailed Description

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 41 of file qgsdoublespinbox.h.

Member Enumeration Documentation

◆ 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 61 of file qgsdoublespinbox.h.

Constructor & Destructor Documentation

◆ QgsDoubleSpinBox()

QgsDoubleSpinBox::QgsDoubleSpinBox ( QWidget *  parent = 0)
explicit

Constructor for QgsDoubleSpinBox.

Parameters
parentparent widget

Definition at line 29 of file qgsdoublespinbox.cpp.

Member Function Documentation

◆ changeEvent()

void QgsDoubleSpinBox::changeEvent ( QEvent *  event)
overrideprotectedvirtual

Definition at line 59 of file qgsdoublespinbox.cpp.

◆ clear()

void QgsDoubleSpinBox::clear ( )
overridevirtual

Set the current value to the value defined by the clear value.

Definition at line 98 of file qgsdoublespinbox.cpp.

◆ clearValue()

double QgsDoubleSpinBox::clearValue ( ) const

Returns the value used when clear() is called.

See also
setClearValue()

◆ 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
Since
QGIS 2.7

Definition at line 97 of file qgsdoublespinbox.h.

◆ paintEvent()

void QgsDoubleSpinBox::paintEvent ( QPaintEvent *  e)
override

Definition at line 87 of file qgsdoublespinbox.cpp.

◆ 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
customValuedefines the numerical value used as the clear value
clearValueTextis the text displayed when the spin box is at the clear value. If not specified, no special value text is used.
See also
setClearValue()

Definition at line 103 of file qgsdoublespinbox.cpp.

◆ setClearValueMode()

void QgsDoubleSpinBox::setClearValueMode ( QgsDoubleSpinBox::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.

Parameters
modemode to user for clear value
clearValueTextis the text displayed when the spin box is at the clear value. If not specified, no special value text is used.

Definition at line 117 of file qgsdoublespinbox.cpp.

◆ setExpressionsEnabled()

void QgsDoubleSpinBox::setExpressionsEnabled ( const bool  enabled)

Sets if the widget will allow entry of simple expressions, which are evaluated and then discarded.

Parameters
enabledset to true to allow expression entry
Since
QGIS 2.7

Definition at line 54 of file qgsdoublespinbox.cpp.

◆ setShowClearButton()

void QgsDoubleSpinBox::setShowClearButton ( const 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
showClearButtonset to true to show the clear button, or false to hide it
See also
showClearButton()

Definition at line 48 of file qgsdoublespinbox.cpp.

◆ showClearButton()

bool QgsDoubleSpinBox::showClearButton ( ) const
inline

Returns whether the widget is showing a clear button.

See also
setShowClearButton()

Definition at line 83 of file qgsdoublespinbox.h.

◆ validate()

QValidator::State QgsDoubleSpinBox::validate ( QString &  input,
int &  pos 
) const
overridevirtual

Definition at line 187 of file qgsdoublespinbox.cpp.

◆ valueFromText()

double QgsDoubleSpinBox::valueFromText ( const QString &  text) const
overridevirtual

Definition at line 171 of file qgsdoublespinbox.cpp.

◆ wheelEvent()

void QgsDoubleSpinBox::wheelEvent ( QWheelEvent *  event)
overrideprotected

Definition at line 65 of file qgsdoublespinbox.cpp.

Property Documentation

◆ clearValue

double QgsDoubleSpinBox::clearValue
readwrite

Definition at line 55 of file qgsdoublespinbox.h.

◆ expressionsEnabled

bool QgsDoubleSpinBox::expressionsEnabled
readwrite

Definition at line 56 of file qgsdoublespinbox.h.

◆ showClearButton

bool QgsDoubleSpinBox::showClearButton
readwrite

Definition at line 54 of file qgsdoublespinbox.h.


The documentation for this class was generated from the following files: