QGIS API Documentation 3.39.0-Master (bca3cdb6021)
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
QgsDoubleValidator Class Reference

QgsDoubleValidator is a QLineEdit Validator that combines QDoubleValidator and QRegularExpressionValidator to allow users to enter doubles with both local and C interpretation as a fallback. More...

#include <qgsdoublevalidator.h>

Inheritance diagram for QgsDoubleValidator:
Inheritance graph
[legend]

Public Member Functions

 QgsDoubleValidator (const QRegularExpression &expression, double bottom, double top, QObject *parent)
 Constructor for QgsDoubleValidator.
 
 QgsDoubleValidator (double bottom, double top, int decimal, QObject *parent)
 Constructor for QgsDoubleValidator.
 
 QgsDoubleValidator (double bottom, double top, QObject *parent)
 Constructor for QgsDoubleValidator.
 
 QgsDoubleValidator (int decimal, QObject *parent)
 Constructor for QgsDoubleValidator.
 
 QgsDoubleValidator (QObject *parent)
 Constructor for QgsDoubleValidator.
 
double bottom () const
 Returns top range limit.
 
void setBottom (double bottom)
 Set top range limit.
 
void setMaxDecimals (int maxDecimals)
 Sets the number of decimals accepted by the validator to maxDecimals.
 
virtual void setRange (double bottom, double top)
 Set bottom and top range limits.
 
void setTop (double top)
 Set top range limit.
 
double top () const
 Returns top range limit.
 
QValidator::State validate (QString &input) const
 Evaluates input string validity according to QRegularExpression and ability to be converted in double value.
 
QValidator::State validate (QString &input, int &) const override
 

Static Public Member Functions

static double toDouble (const QString &input)
 Converts input string to double value.
 
static double toDouble (const QString &input, bool *ok)
 Converts input string to double value.
 

Detailed Description

QgsDoubleValidator is a QLineEdit Validator that combines QDoubleValidator and QRegularExpressionValidator to allow users to enter doubles with both local and C interpretation as a fallback.

Since
QGIS 3.14

Definition at line 40 of file qgsdoublevalidator.h.

Constructor & Destructor Documentation

◆ QgsDoubleValidator() [1/5]

QgsDoubleValidator::QgsDoubleValidator ( QObject *  parent)
explicit

Constructor for QgsDoubleValidator.

Definition at line 30 of file qgsdoublevalidator.cpp.

◆ QgsDoubleValidator() [2/5]

QgsDoubleValidator::QgsDoubleValidator ( const QRegularExpression &  expression,
double  bottom,
double  top,
QObject *  parent 
)

Constructor for QgsDoubleValidator.

Parameters
bottomthe minimal range limit accepted by the validator
topthe maximal range limit accepted by the validator
parentparent object
expressioncustom regular expression

Definition at line 43 of file qgsdoublevalidator.cpp.

◆ QgsDoubleValidator() [3/5]

QgsDoubleValidator::QgsDoubleValidator ( double  bottom,
double  top,
QObject *  parent 
)

Constructor for QgsDoubleValidator.

Parameters
bottomthe minimal range limit accepted by the validator
topthe maximal range limit accepted by the validator
parentparent object

Definition at line 51 of file qgsdoublevalidator.cpp.

◆ QgsDoubleValidator() [4/5]

QgsDoubleValidator::QgsDoubleValidator ( double  bottom,
double  top,
int  decimal,
QObject *  parent 
)

Constructor for QgsDoubleValidator.

Parameters
bottomthe minimal range limit accepted by the validator
topthe maximal range limit accepted by the validator
decimalthe number of decimals accepted by the validator
parentparent object

Definition at line 64 of file qgsdoublevalidator.cpp.

◆ QgsDoubleValidator() [5/5]

QgsDoubleValidator::QgsDoubleValidator ( int  decimal,
QObject *  parent 
)

Constructor for QgsDoubleValidator.

Parameters
decimalthe number of decimals accepted by the validator
parentparent object
Since
QGIS 3.16

Definition at line 77 of file qgsdoublevalidator.cpp.

Member Function Documentation

◆ bottom()

double QgsDoubleValidator::bottom ( ) const
inline

Returns top range limit.

See also
setBottom

Definition at line 148 of file qgsdoublevalidator.h.

◆ setBottom()

void QgsDoubleValidator::setBottom ( double  bottom)
inline

Set top range limit.

See also
setTop
setRange

Definition at line 124 of file qgsdoublevalidator.h.

◆ setMaxDecimals()

void QgsDoubleValidator::setMaxDecimals ( int  maxDecimals)

Sets the number of decimals accepted by the validator to maxDecimals.

Warning
setting decimals overrides any custom regular expression that was previously set
Since
QGIS 3.22

Definition at line 90 of file qgsdoublevalidator.cpp.

◆ setRange()

virtual void QgsDoubleValidator::setRange ( double  bottom,
double  top 
)
inlinevirtual

Set bottom and top range limits.

See also
setBottom
setTop

Definition at line 138 of file qgsdoublevalidator.h.

◆ setTop()

void QgsDoubleValidator::setTop ( double  top)
inline

Set top range limit.

See also
setBottom
setRange

Definition at line 131 of file qgsdoublevalidator.h.

◆ toDouble() [1/2]

double QgsDoubleValidator::toDouble ( const QString &  input)
static

Converts input string to double value.

It uses locale interpretation first and C locale interpretation as fallback

Definition at line 143 of file qgsdoublevalidator.cpp.

◆ toDouble() [2/2]

double QgsDoubleValidator::toDouble ( const QString &  input,
bool *  ok 
)
static

Converts input string to double value.

It uses locale interpretation first and C locale interpretation as fallback

Definition at line 149 of file qgsdoublevalidator.cpp.

◆ top()

double QgsDoubleValidator::top ( ) const
inline

Returns top range limit.

See also
setTop

Definition at line 154 of file qgsdoublevalidator.h.

◆ validate() [1/2]

QValidator::State QgsDoubleValidator::validate ( QString &  input) const

Evaluates input string validity according to QRegularExpression and ability to be converted in double value.

Definition at line 121 of file qgsdoublevalidator.cpp.

◆ validate() [2/2]

QValidator::State QgsDoubleValidator::validate ( QString &  input,
int &   
) const
override

Definition at line 99 of file qgsdoublevalidator.cpp.


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