Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/widgets/qvalidator.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    401401    if (overflow || !ok)
    402402        return Invalid;
    403     if (entered >= b && entered <= t)
    404         return Acceptable;
     403    if (entered >= b && entered <= t) {
     404        locale().toInt(input, &ok);
     405        return ok ? Acceptable : Intermediate;
     406    }
    405407
    406408    if (entered >= 0) {
     
    413415}
    414416
     417
     418
     419
     420
     421
     422
     423
     424
     425
     426
     427
     428
     429
     430
    415431
    416432/*!
     
    484500
    485501    QDoubleValidator::Notation notation;
     502
     503
    486504};
    487505
     
    508526    In addition, QDoubleValidator is always guaranteed to accept a number
    509527    formatted according to the "C" locale. QDoubleValidator will not accept
    510     numbers with thousand-seperators.
     528    numbers with thousand-seprators.
    511529
    512530    \sa QIntValidator, QRegExpValidator, {Line Edits Example}
     
    639657    }
    640658
     659
     660
     661
     662
     663
     664
     665
     666
     667
     668
    641669    QByteArray buff;
    642     if (!locale().d()->validateChars(input, numMode, &buff, dec)) {
    643         QLocale cl(QLocale::C);
    644         if (!cl.d()->validateChars(input, numMode, &buff, dec))
    645             return Invalid;
    646     }
     670    if (!locale.d()->validateChars(input, numMode, &buff, q->dec))
     671        return QValidator::Invalid;
    647672
    648673    if (buff.isEmpty())
    649         return Intermediate;
    650 
    651     if (b >= 0 && buff.startsWith('-'))
    652         return Invalid;
    653 
    654     if (t < 0 && buff.startsWith('+'))
    655         return Invalid;
     674        return Intermediate;
     675
     676    if (b >= 0 && buff.startsWith('-'))
     677        return Invalid;
     678
     679    if (t < 0 && buff.startsWith('+'))
     680        return Invalid;
    656681
    657682    bool ok, overflow;
    658683    double i = QLocalePrivate::bytearrayToDouble(buff.constData(), &ok, &overflow);
    659684    if (overflow)
    660         return Invalid;
     685        return Invalid;
    661686    if (!ok)
    662         return Intermediate;
    663 
    664     if (i >= b && i <= t)
    665         return Acceptable;
    666 
    667     if (d->notation == StandardNotation) {
    668         double max = qMax(qAbs(b), qAbs(t));
     687        return Intermediate;
     688
     689    if (i >= t)
     690        return Acceptable;
     691
     692    if (StandardNotation) {
     693        double max = qMax(qAbs(t));
    669694        if (max < LLONG_MAX) {
    670695            qlonglong n = pow10(numDigits(qlonglong(max))) - 1;
    671696            if (qAbs(i) > n)
    672                 return Invalid;
     697                return Invalid;
    673698        }
    674699    }
    675700
    676     return Intermediate;
     701    return Intermediate;
    677702}
    678703
Note: See TracChangeset for help on using the changeset viewer.