Skip to content
Permalink
Browse files
revert decimals
  • Loading branch information
elpaso committed Jul 1, 2021
1 parent 1600e25 commit b69c9da65034704586ce863b6c46dcac62304d41
@@ -50,21 +50,21 @@ Constructor for QgsDoubleValidator.
:param parent: parent object
%End

QgsDoubleValidator( double bottom, double top, int decimals, QObject *parent );
QgsDoubleValidator( double bottom, double top, int decimal, QObject *parent );
%Docstring
Constructor for QgsDoubleValidator.

:param bottom: the minimal range limit accepted by the validator
:param top: the maximal range limit accepted by the validator
:param decimals: the number of decimals accepted by the validator
:param decimal: the number of decimals accepted by the validator
:param parent: parent object
%End

QgsDoubleValidator( int decimals, QObject *parent );
QgsDoubleValidator( int decimal, QObject *parent );
%Docstring
Constructor for QgsDoubleValidator.

:param decimals: the number of decimals accepted by the validator
:param decimal: the number of decimals accepted by the validator
:param parent: parent object

.. versionadded:: 3.16
@@ -76,7 +76,7 @@ Sets the number of decimals accepted by the validator to ``maxDecimals``.

.. warning::

setting decimals overrides any custom regular expression that was previosly set
setting decimals overrides any custom regular expression that was previously set

.. versionadded:: 3.22
%End
@@ -55,23 +55,23 @@ QgsDoubleValidator::QgsDoubleValidator( double bottom, double top, QObject *pare
setRegularExpression( reg );
}

QgsDoubleValidator::QgsDoubleValidator( double bottom, double top, int decimals, QObject *parent )
QgsDoubleValidator::QgsDoubleValidator( double bottom, double top, int decimal, QObject *parent )
: QRegularExpressionValidator( parent )
, mMinimum( bottom )
, mMaximum( top )
{
// The regular expression accept double with point as decimal point but also the locale decimal point
QRegularExpression reg( PERMISSIVE_DOUBLE.arg( locale().decimalPoint() ).arg( QString::number( decimals ) ) );
QRegularExpression reg( PERMISSIVE_DOUBLE.arg( locale().decimalPoint() ).arg( QString::number( decimal ) ) );
setRegularExpression( reg );
}

QgsDoubleValidator::QgsDoubleValidator( int decimals, QObject *parent )
QgsDoubleValidator::QgsDoubleValidator( int decimal, QObject *parent )
: QRegularExpressionValidator( parent )
, mMinimum( std::numeric_limits<qreal>::lowest() )
, mMaximum( std::numeric_limits<qreal>::max() )
{
// The regular expression accept double with point as decimal point but also the locale decimal point
QRegularExpression reg( PERMISSIVE_DOUBLE.arg( locale().decimalPoint() ).arg( QString::number( decimals ) ) );
QRegularExpression reg( PERMISSIVE_DOUBLE.arg( locale().decimalPoint() ).arg( QString::number( decimal ) ) );
setRegularExpression( reg );
}

@@ -72,23 +72,23 @@ class GUI_EXPORT QgsDoubleValidator : public QRegularExpressionValidator
*
* \param bottom the minimal range limit accepted by the validator
* \param top the maximal range limit accepted by the validator
* \param decimals the number of decimals accepted by the validator
* \param decimal the number of decimals accepted by the validator
* \param parent parent object
*/
QgsDoubleValidator( double bottom, double top, int decimals, QObject *parent );
QgsDoubleValidator( double bottom, double top, int decimal, QObject *parent );

/**
* Constructor for QgsDoubleValidator.
*
* \param decimals the number of decimals accepted by the validator
* \param decimal the number of decimals accepted by the validator
* \param parent parent object
* \since QGIS 3.16
*/
QgsDoubleValidator( int decimals, QObject *parent );
QgsDoubleValidator( int decimal, QObject *parent );

/**
* Sets the number of decimals accepted by the validator to \a maxDecimals.
* \warning setting decimals overrides any custom regular expression that was previosly set
* \warning setting decimals overrides any custom regular expression that was previously set
* \since QGIS 3.22
*/
void setMaxDecimals( int maxDecimals );

0 comments on commit b69c9da

Please sign in to comment.