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