Changeset 846 for trunk/src/gui/widgets/qvalidator.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/widgets/qvalidator.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 401 401 if (overflow || !ok) 402 402 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 } 405 407 406 408 if (entered >= 0) { … … 413 415 } 414 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 415 431 416 432 /*! … … 484 500 485 501 QDoubleValidator::Notation notation; 502 503 486 504 }; 487 505 … … 508 526 In addition, QDoubleValidator is always guaranteed to accept a number 509 527 formatted according to the "C" locale. QDoubleValidator will not accept 510 numbers with thousand-sep erators.528 numbers with thousand-seprators. 511 529 512 530 \sa QIntValidator, QRegExpValidator, {Line Edits Example} … … 639 657 } 640 658 659 660 661 662 663 664 665 666 667 668 641 669 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; 647 672 648 673 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; 656 681 657 682 bool ok, overflow; 658 683 double i = QLocalePrivate::bytearrayToDouble(buff.constData(), &ok, &overflow); 659 684 if (overflow) 660 return Invalid;685 return Invalid; 661 686 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)); 669 694 if (max < LLONG_MAX) { 670 695 qlonglong n = pow10(numDigits(qlonglong(max))) - 1; 671 696 if (qAbs(i) > n) 672 return Invalid;697 return Invalid; 673 698 } 674 699 } 675 700 676 return Intermediate;701 return Intermediate; 677 702 } 678 703
Note:
See TracChangeset
for help on using the changeset viewer.