Document the behavior of QLineEdit::inputMask correctly

QLineEdit is unicode, and uses QChar::isLetter and QChar::isNumber to
evaluate whether an input character is valid. There is no test for ASCII
ranges, or converting of input characters to ASCII, so the documentation
was wrong.

[ChangeLog][QtWidgets][QLineEdit] the inputMask property has allowed any
Letter or Number category character for the respective mask characters,
not just ASCII. The documentation has been updated accordingly.

Change-Id: Ied93cf6ddd334ac91bfbc275107a8eb83d231d80
Fixes: QTBUG-82291
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
This commit is contained in:
Volker Hilsheimer 2020-02-24 14:00:49 +01:00
parent 8b9a025373
commit c6dd2e2367
1 changed files with 18 additions and 14 deletions

View File

@ -1200,8 +1200,8 @@ QMargins QLineEdit::textMargins() const
The input mask is an input template string. It can contain the following elements:
\table
\row \li Mask Characters \li Defines the class of input characters that are
considered valid in this position
\row \li Mask Characters \li Defines the \l {QChar::} {Category} of input characters
that are considered valid in this position
\row \li Meta Characters \li Various special meanings
\row \li Separators \li All other characters are regarded as immutable separators
\endtable
@ -1210,17 +1210,21 @@ QMargins QLineEdit::textMargins() const
\table
\header \li Mask Character \li Meaning
\row \li \c A \li ASCII alphabetic character required. A-Z, a-z.
\row \li \c a \li ASCII alphabetic character permitted but not required.
\row \li \c N \li ASCII alphanumeric character required. A-Z, a-z, 0-9.
\row \li \c n \li ASCII alphanumeric character permitted but not required.
\row \li \c X \li Any character required.
\row \li \c x \li Any character permitted but not required.
\row \li \c 9 \li ASCII digit required. 0-9.
\row \li \c 0 \li ASCII digit permitted but not required.
\row \li \c D \li ASCII digit required. 1-9.
\row \li \c d \li ASCII digit permitted but not required (1-9).
\row \li \c # \li ASCII digit or plus/minus sign permitted but not required.
\row \li \c A \li character of the Letter category required, such as A-Z, a-z.
\row \li \c a \li character of the Letter category permitted but not required.
\row \li \c N \li character of the Letter or Number category required, such as
A-Z, a-z, 0-9.
\row \li \c n \li character of the Letter or Number category permitted but not required.
\row \li \c X \li Any non-blank character required.
\row \li \c x \li Any non-blank character permitted but not required.
\row \li \c 9 \li character of the Number category required, e.g 0-9.
\row \li \c 0 \li character of the Number category permitted but not required.
\row \li \c D \li character of the Number category and larger than zero required,
such as 1-9
\row \li \c d \li character of the Number category and larger than zero permitted but not
required, such as 1-9.
\row \li \c # \li character of the Number category, or plus/minus sign permitted but not
required.
\row \li \c H \li Hexadecimal character required. A-F, a-f, 0-9.
\row \li \c h \li Hexadecimal character permitted but not required.
\row \li \c B \li Binary character required. 0-1.
@ -1262,7 +1266,7 @@ QMargins QLineEdit::textMargins() const
To get range control (e.g., for an IP address) use masks together
with \l{setValidator()}{validators}.
\sa maxLength
\sa maxLength, QChar::isLetter(), QChar::isNumber(), QChar::digitValue()
*/
QString QLineEdit::inputMask() const
{