From 59849fbfee43324f96409ce68387369edec4f8e3 Mon Sep 17 00:00:00 2001 From: Leena Miettinen <riitta-leena.miettinen@nokia.com> Date: Tue, 28 Sep 2010 14:49:44 +0200 Subject: [PATCH] Doc - Validating user input in custom wizards Reviewed-by: Friedemann Kleint --- doc/qtcreator.qdoc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/doc/qtcreator.qdoc b/doc/qtcreator.qdoc index 352597582b..d0ba687ac7 100644 --- a/doc/qtcreator.qdoc +++ b/doc/qtcreator.qdoc @@ -2251,6 +2251,27 @@ \endlist + \section1 Validating User Input + + You can specify validation rules for user input. The rules consist of a Boolean + JavaScript expression and an error message. The placeholders in them are + replaced with values before they are evaluated or displayed. + + Consider the following rule used in the \l{Creating Class Wizards} example: + + \code + <validationrules> + <validationrule condition='"%ClassName%" != "QAbstractListModel"'> + <message>%ClassName% cannot be used as class name.</message> + <message xml:lang="de">%ClassName% kann nicht als Klassenname verwendet werden.</message> + </validationrule> + </validationrules> + \endcode + + It ensures that the class name entered by the user does not match the name of + the base class. If the validation fails, a red label displaying the message appears + at the bottom of the wizard page. + \section1 Using Generator Scripts The values entered in the wizard page are passed to the script -- GitLab