From 641c3fa2204ac9c67b683e8571dc428f5048bf8f Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 27 Jun 2012 12:51:43 +1000 Subject: [PATCH] Document the arg() function QML adds to the String prototype. Task-number: QTBUG-23577 Change-Id: I6279860bd3bf2d60bc394c012ea1c64bdd9be6fa Reviewed-by: Michael Brasser --- src/qml/doc/src/javascript/hostenvironment.qdoc | 2 +- src/qml/doc/src/javascript/string.qdoc | 51 +++++++++++++++++++++++++ src/qml/doc/src/typesystem/basictypes.qdoc | 3 ++ 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 src/qml/doc/src/javascript/string.qdoc diff --git a/src/qml/doc/src/javascript/hostenvironment.qdoc b/src/qml/doc/src/javascript/hostenvironment.qdoc index 77a57ad..01c55a0 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 0000000..b9a6ac1 --- /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 c24787b..2689e31 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} */ -- 2.7.4