Initial import from the monolithic Qt.
[profile/ivi/qtdeclarative.git] / doc / src / declarative / qmltexthandling.qdoc
1 /****************************************************************************
2 **
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
6 **
7 ** This file is part of the documentation of the Qt Toolkit.
8 **
9 ** $QT_BEGIN_LICENSE:FDL$
10 ** No Commercial Usage
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
14 ** this package.
15 **
16 ** GNU Free Documentation License
17 ** Alternatively, this file may be used under the terms of the GNU Free
18 ** Documentation License version 1.3 as published by the Free Software
19 ** Foundation and appearing in the file included in the packaging of this
20 ** file.
21 **
22 ** If you have questions regarding the use of this file, please contact
23 ** Nokia at qt-info@nokia.com.
24 ** $QT_END_LICENSE$
25 **
26 ****************************************************************************/
27
28 /*!
29 \page texthandling.html
30 \title QML Text Handling and Validators
31 \ingroup QML Features
32 \previouspage {QML Mouse Events}{Mouse Events}
33 \nextpage {Keyboard Focus in QML}{Keyboard Focus}
34 \contentspage QML Features
35
36 \tableofcontents
37
38 \section1 Text Elements
39
40 \list
41 \o \l{Text}
42 \o \l{TextInput}
43 \o \l{TextEdit}
44 \endlist
45
46 \section1 Validators
47 \list
48 \o \l{IntValidator}
49 \o \l{DoubleValidator}
50 \o \l{RegExpValidator}
51 \endlist
52
53 \section1 Displaying Text in QML
54 QML provides several elements to display text onto the screen. The \l Text
55 element will display formatted text onto the screen, the \l TextEdit element
56 will place a multiline line edit onto the screen, and the \l TextInput will
57 place a single editable line field onto the screen.
58
59 To learn more about their specific features and properties, visit their
60 respective element documentation.
61
62 \section1 Validating Input Text
63 The \l {Validators}{validator} elements enforce the type and format of
64 \l TextInput objects.
65
66 \snippet doc/src/snippets/declarative/texthandling.qml int validator
67 The validator elements bind to \c {TextInput}'s \c validator property.
68
69 \snippet doc/src/snippets/declarative/texthandling.qml regexp validator
70 The regular expression in the snippet will only allow the inputted text to be
71 \c {fruit basket}.
72
73 Note that QML parses JavaScript regular expressions, while Qt's
74 \l {QRegExp} class' regular expressions are based on Perl regular expressions.
75
76 */