1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
6 ** This file is part of the documentation of the Qt Toolkit.
8 ** $QT_BEGIN_LICENSE:FDL$
9 ** GNU Free Documentation License
10 ** Alternatively, this file may be used under the terms of the GNU Free
11 ** Documentation License version 1.3 as published by the Free Software
12 ** Foundation and appearing in the file included in the packaging of
16 ** Alternatively, this file may be used in accordance with the terms
17 ** and conditions contained in a signed written agreement between you
26 ****************************************************************************/
29 \page qtquick-texthandling.html
30 \title Text Handling and Validators
31 \brief elements that accept and handle text input
35 \section1 Text Elements
46 \li \l{DoubleValidator}
47 \li \l{RegExpValidator}
50 \section1 Displaying Text in QML
51 QML provides several elements to display text onto the screen. The \l Text
52 element will display formatted text onto the screen, the \l TextEdit element
53 will place a multiline line edit onto the screen, and the \l TextInput will
54 place a single editable line field onto the screen.
56 To learn more about their specific features and properties, visit their
57 respective element documentation.
59 \section1 Validating Input Text
60 The \l {Validators}{validator} elements enforce the type and format of
63 \snippet doc/snippets/qml/texthandling.qml int validator
64 The validator elements bind to \c {TextInput}'s \c validator property.
66 \snippet doc/snippets/qml/texthandling.qml regexp validator
67 The regular expression in the snippet will only allow the inputted text to be
70 Note that QML parses JavaScript regular expressions, while Qt's
71 \l {QRegExp} class' regular expressions are based on Perl regular expressions.