aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2012-06-27 12:51:43 +1000
committerQt by Nokia <qt-info@nokia.com>2012-06-27 07:26:46 +0200
commit641c3fa2204ac9c67b683e8571dc428f5048bf8f (patch)
treed1332df29fc0ebf7d26344777d3311c72e4f5f30 /src
parent6afc3be37712416aa56940848aebe7682ad9e88f (diff)
Document the arg() function QML adds to the String prototype.
Task-number: QTBUG-23577 Change-Id: I6279860bd3bf2d60bc394c012ea1c64bdd9be6fa Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/qml/doc/src/javascript/hostenvironment.qdoc2
-rw-r--r--src/qml/doc/src/javascript/string.qdoc51
-rw-r--r--src/qml/doc/src/typesystem/basictypes.qdoc3
3 files changed, 55 insertions, 1 deletions
diff --git a/src/qml/doc/src/javascript/hostenvironment.qdoc b/src/qml/doc/src/javascript/hostenvironment.qdoc
index 77a57ad548..01c55a00ef 100644
--- a/src/qml/doc/src/javascript/hostenvironment.qdoc
+++ b/src/qml/doc/src/javascript/hostenvironment.qdoc
@@ -63,7 +63,7 @@ detailed in the \l{QML Global Object} documentation.
QML makes the following modifications to native objects:
\list
-\li An arg() function is added to the String prototype.
+\li An \l {String::arg}{arg()} function is added to the \l String prototype.
\li Locale-aware coversion functions are added to the \l Date and \l Number prototypes.
\endlist
diff --git a/src/qml/doc/src/javascript/string.qdoc b/src/qml/doc/src/javascript/string.qdoc
new file mode 100644
index 0000000000..b9a6ac1051
--- /dev/null
+++ b/src/qml/doc/src/javascript/string.qdoc
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \qmlclass String
+ \inqmlmodule QtQuick 2
+ \brief The String object represents a string value
+
+ The QML String object extends the JS String object with
+ the arg() function.
+
+ \sa {ECMA-262}{ECMAScript Language Specification}
+*/
+
+/*!
+ \qmlmethod string String::arg(value)
+
+ Returns a copy of this string with the lowest numbered place marker replaced by value,
+ i.e., %1, %2, ..., %99. The following example prints "There are 20 items"
+
+ \code
+ var message = "There are %1 items"
+ var count = 20
+ console.log(message.arg(count))
+ \endcode
+*/
+
diff --git a/src/qml/doc/src/typesystem/basictypes.qdoc b/src/qml/doc/src/typesystem/basictypes.qdoc
index c24787b4c8..2689e3104e 100644
--- a/src/qml/doc/src/typesystem/basictypes.qdoc
+++ b/src/qml/doc/src/typesystem/basictypes.qdoc
@@ -142,6 +142,9 @@ See \l {QML Basic Types} for the list of basic types that are supported by the Q
Strings have a \c length attribute that holds the number of
characters in the string.
+ QML extends the JavaScript String type with a \l {String::arg}{arg()} function
+ to support value substitution.
+
\sa {QML Basic Types}
*/