summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-02-24 14:00:49 +0100
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-02-26 23:26:44 +0100
commitc6dd2e2367885d348e02440f23fd0bd54644c6f4 (patch)
tree5a8807fa92ecb56eae95661cf46c84875ecd93b0 /src
parent8b9a02537300507d21d58ac7d3db4fe1a2f2fe62 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/widgets/qlineedit.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index eaf31551d9..6aa641ebe6 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -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
{