diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2014-11-19 09:21:25 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2014-11-19 10:11:58 +0100 |
commit | c2c48b3ea9e1b6c7b3eb7d7a5b660bce8e6ff4ca (patch) | |
tree | 10d1d63b29ed7a9902df7e819a857aa2689ff55d /src/gui/util | |
parent | ccd4da392c366dd4f7f71fa3b8aeddde1b3bc169 (diff) |
Add a note about group separators to numeric validators.
Task-number: QTBUG-42522
Change-Id: I202cb98c51ba2332000772edfdc47d47c56e49c9
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
Diffstat (limited to 'src/gui/util')
-rw-r--r-- | src/gui/util/qvalidator.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gui/util/qvalidator.cpp b/src/gui/util/qvalidator.cpp index 1b5a10f733..93990a8748 100644 --- a/src/gui/util/qvalidator.cpp +++ b/src/gui/util/qvalidator.cpp @@ -316,7 +316,12 @@ void QValidator::fixup(QString &) const QIntValidator uses its locale() to interpret the number. For example, in Arabic locales, QIntValidator will accept Arabic digits. - \sa QDoubleValidator, QRegExpValidator, {Line Edits Example} + \note The QLocale::NumberOptions set on the locale() also affect the + way the number is interpreted. For example, since QLocale::RejectGroupSeparator + is not set by default, the validator will accept group separators. It is thus + recommended to use QLocale::toInt() to obtain the numeric value. + + \sa QDoubleValidator, QRegExpValidator, QLocale::toInt(), {Line Edits Example} */ /*! @@ -548,7 +553,12 @@ public: in the German locale, "1,234" will be accepted as the fractional number 1.234. In Arabic locales, QDoubleValidator will accept Arabic digits. - \sa QIntValidator, QRegExpValidator, {Line Edits Example} + \note The QLocale::NumberOptions set on the locale() also affect the + way the number is interpreted. For example, since QLocale::RejectGroupSeparator + is not set by default, the validator will accept group separators. It is thus + recommended to use QLocale::toDouble() to obtain the numeric value. + + \sa QIntValidator, QRegExpValidator, QLocale::toDouble(), {Line Edits Example} */ /*! |