From bbda968a0a3230b1ddb55b27e4dcc627fc087bbd Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sun, 14 Oct 2012 04:12:35 +0100 Subject: Fix QRegExpValidator::validate docs about the pos parameter The code sets it to input.length() iff the regexp doesn't match the string, while the docs say it's *always* set. Therefore, make the docs match what the code does and add a simple test to enforce it. We're not changing the code to match the docs because 1) it's better to stay conservative (we don't want to break existing behaviour); 2) this behaviour mimics what the int/double validators do (they don't move pos at all). Change-Id: I958074558de6b0fc5944101c6535fc7e00442ae9 Reviewed-by: Marc Mutz --- src/gui/util/qvalidator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/util/qvalidator.cpp b/src/gui/util/qvalidator.cpp index 49945ae5b0..6231a097d3 100644 --- a/src/gui/util/qvalidator.cpp +++ b/src/gui/util/qvalidator.cpp @@ -862,7 +862,8 @@ QRegExpValidator::~QRegExpValidator() partially (i.e. could be a valid match if additional valid characters are added), and \l Invalid if \a input is not matched. - The \a pos parameter is set to the length of the \a input parameter. + Additionally, if \a input is not matched, the \a pos parameter is set to + the length of the \a input parameter. For example, if the regular expression is \b{\\w\\d\\d} (word-character, digit, digit) then "A57" is \l Acceptable, -- cgit v1.2.3