Skip to content

Commit

Permalink
revert decimals
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Jul 1, 2021
1 parent 1600e25 commit b69c9da
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions python/gui/auto_generated/qgsdoublevalidator.sip.in
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/gui/qgsdoublevalidator.cpp
Expand Up @@ -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 );
}

Expand Down
10 changes: 5 additions & 5 deletions src/gui/qgsdoublevalidator.h
Expand Up @@ -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 );
Expand Down

0 comments on commit b69c9da

Please sign in to comment.