21 #include <QRegExpValidator> 
   22 #include <QRegularExpression> 
   28 const QString 
PERMISSIVE_DOUBLE = R
"(-?[\d]{0,1000}([\.%1][\d]{0,1000})?(e[+-]?[\d]{0,%2})?)"; 
   31   : QRegularExpressionValidator( parent ) 
   32   , mMinimum( std::numeric_limits<qreal>::lowest() ) 
   33   , mMaximum( std::numeric_limits<qreal>::max() ) 
   36   QRegularExpression reg( 
PERMISSIVE_DOUBLE.arg( locale().decimalPoint() ).arg( 1000 ) );
 
   37   setRegularExpression( reg );
 
   41   : QRegularExpressionValidator( parent )
 
   45   setRegularExpression( expression );
 
   49   : QRegularExpressionValidator( parent )
 
   54   QRegularExpression reg( 
PERMISSIVE_DOUBLE.arg( locale().decimalPoint() ).arg( 1000 ) );
 
   55   setRegularExpression( reg );
 
   59   : QRegularExpressionValidator( parent )
 
   64   QRegularExpression reg( 
PERMISSIVE_DOUBLE.arg( locale().decimalPoint() ).arg( QString::number( decimal ) ) );
 
   65   setRegularExpression( reg );
 
   69   : QRegularExpressionValidator( parent )
 
   70   , mMinimum( std::numeric_limits<qreal>::lowest() )
 
   71   , mMaximum( std::numeric_limits<qreal>::max() )
 
   74   QRegularExpression reg( 
PERMISSIVE_DOUBLE.arg( locale().decimalPoint() ).arg( QString::number( decimal ) ) );
 
   75   setRegularExpression( reg );
 
   80   if ( input.isEmpty() )
 
   88     if ( regularExpression().match( input ).captured( 0 ) == input )
 
   94   if ( entered >= mMinimum && entered <= mMaximum && regularExpression().match( input ).captured( 0 ) == input )
 
  102   if ( input.isEmpty() )
 
  110     if ( regularExpression().match( input ).captured( 0 ) == input )
 
  116   if ( entered >= mMinimum && entered <= mMaximum && regularExpression().match( input ).captured( 0 ) == input )
 
  125   double value = QLocale().toDouble( input, &ok );
 
  128     value = QLocale( QLocale::C ).toDouble( input, &ok );
 
  135   double value = QLocale().toDouble( input, ok );
 
  139     value = QLocale( QLocale::C ).toDouble( input, ok );
 
static double toDouble(const QString &input, bool *ok)
Converts input string to double value.
QgsDoubleValidator(QObject *parent)
Constructor for QgsDoubleValidator.
QValidator::State validate(QString &input, int &) const override
const QString PERMISSIVE_DOUBLE