From 5f2ec1a8c73fc7b6c20595110c0e04af21469082 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Thu, 12 Jan 2017 12:45:58 +0100 Subject: Doc: add doc and examples to RegExpValidator QML type Change-Id: I0ebc06aec6d2392f613fb4c312c189cc1d90a184 Reviewed-by: Venugopal Shivashankar --- src/quick/util/qquickvalidator.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/quick/util') diff --git a/src/quick/util/qquickvalidator.cpp b/src/quick/util/qquickvalidator.cpp index a05117bd06..93f414fe80 100644 --- a/src/quick/util/qquickvalidator.cpp +++ b/src/quick/util/qquickvalidator.cpp @@ -219,6 +219,19 @@ void QQuickDoubleValidator::resetLocaleName() matching "a". By default, this property contains a regular expression with the pattern .* that matches any string. + + Below you can find an example of a \l TextInput object with a RegExpValidator specified: + + \snippet qml/regexp.qml 0 + + Some more examples of regular expressions: + + \list + \li A list of numbers with one to three positions separated by a comma: + /\d{1,3}(?:,\d{1,3})+$/ + \li An amount consisting of up to 3 numbers before the decimal point, and + 1 to 2 after the decimal point: \li /(\d{1,3})([.,]\d{1,2})?$/ + \endlist */ #endif // validator -- cgit v1.2.3