From ebbb0257e65b762ac6c3cf2baa19bbb5d581d071 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Tue, 14 May 2013 12:41:32 +0200 Subject: [PATCH] Doc: Define Qt global object as a QML type and fix referring docs This change adds the Qt global object as a QML type in the Qt QML module and fixes links to it in documentation. Task-number: QTBUG-29353 Change-Id: I1690224091a79a3309fac7a78aa0c0c734449e4f Reviewed-by: Mitch Curtis Reviewed-by: Jerome Pasion --- src/qml/doc/src/cppclasses/topic.qdoc | 2 +- src/qml/doc/src/cppintegration/contextproperties.qdoc | 2 +- src/qml/doc/src/cppintegration/data.qdoc | 2 +- src/qml/doc/src/javascript/dynamicobjectcreation.qdoc | 16 ++++++++-------- src/qml/doc/src/javascript/imports.qdoc | 6 +++--- src/qml/doc/src/qmltypereference.qdoc | 10 +++++----- src/qml/doc/src/whatsnew.qdoc | 2 +- src/qml/qml/qqmlcomponent.cpp | 2 +- src/qml/qml/qqmlengine.cpp | 5 +++-- src/qml/qml/qqmllocale.cpp | 4 ++-- src/qml/qml/v8/qqmlbuiltinfunctions.cpp | 10 +++++----- src/quick/doc/src/advtutorial.qdoc | 2 +- src/quick/doc/src/concepts/positioning/righttoleft.qdoc | 2 +- src/quick/doc/src/qmltypereference.qdoc | 14 +++++++------- 14 files changed, 40 insertions(+), 39 deletions(-) diff --git a/src/qml/doc/src/cppclasses/topic.qdoc b/src/qml/doc/src/cppclasses/topic.qdoc index 66a374e..7c21793 100644 --- a/src/qml/doc/src/cppclasses/topic.qdoc +++ b/src/qml/doc/src/cppclasses/topic.qdoc @@ -88,7 +88,7 @@ properties of a QQmlContext, and how to access the context for an object. Dynamic object instantiation and dynamic expression evaluation are both core concepts in QML. QML documents define object types which can be instantiated at run-time using a QQmlComponent. An instance of the QQmlComponent class can -be created in C++ directly, or via the \l{QML:Qt::createComponent()} +be created in C++ directly, or via the \l{QtQml2::Qt::createComponent()} {Qt.createComponent()} function in imperative QML code. Arbitrary expressions can be calculated in C++ via the QQmlExpression class, and such expressions can interact directly the QML context. diff --git a/src/qml/doc/src/cppintegration/contextproperties.qdoc b/src/qml/doc/src/cppintegration/contextproperties.qdoc index aaac43e..1c2bced 100644 --- a/src/qml/doc/src/cppintegration/contextproperties.qdoc +++ b/src/qml/doc/src/cppintegration/contextproperties.qdoc @@ -74,7 +74,7 @@ QML code invokes a method on the object instance: \endtable (Note that date/time values returned from C++ to QML can be formatted through -\l{QML:Qt::formatDateTime}{Qt.formatDateTime()} and associated functions.) +\l{QtQml2::Qt::formatDateTime}{Qt.formatDateTime()} and associated functions.) If the QML item needs to receive signals from the context property, it can connect to them using the \l Connections type. For example, if \c ApplicationData has a signal named \c diff --git a/src/qml/doc/src/cppintegration/data.qdoc b/src/qml/doc/src/cppintegration/data.qdoc index dc1b4ca..74a9343 100644 --- a/src/qml/doc/src/cppintegration/data.qdoc +++ b/src/qml/doc/src/cppintegration/data.qdoc @@ -124,7 +124,7 @@ QQuaternion and QMatrix4x4, are only available from QML when the \l {Qt Quick} module is included. As a convenience, many of these types can be specified in QML by string values, -or by a related method provided by the \l {QML:Qt} object. For example, the \l +or by a related method provided by the \l {QtQml2::Qt} object. For example, the \l {Image::sourceSize} property is of type \l size (which automatically translates to the QSize type) and can be specified by a string value formatted as "width\c{x}height", or by the Qt.size() function: diff --git a/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc b/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc index 421b180..8020f03 100644 --- a/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc +++ b/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc @@ -42,8 +42,8 @@ demonstration of the concepts discussed on this page. \section1 Creating Objects Dynamically There are two ways to create objects dynamically from JavaScript. You can -either call \l {QML:Qt::createComponent()}{Qt.createComponent()} to -dynamically create a \l Component object, or use \l{QML:Qt::createQmlObject()} +either call \l {QtQml2::Qt::createComponent()}{Qt.createComponent()} to +dynamically create a \l Component object, or use \l{QtQml2::Qt::createQmlObject()} {Qt.createQmlObject()} to create an object from a string of QML. Creating a component is better if you have an existing component defined in a QML document and you want to dynamically create instances of that component. Otherwise, @@ -54,7 +54,7 @@ generated at runtime. \section2 Creating a Component Dynamically To dynamically load a component defined in a QML file, call the -\l {QML:Qt::createComponent()}{Qt.createComponent()} function in the +\l {QtQml2::Qt::createComponent()}{Qt.createComponent()} function in the \l {QmlGlobalQtObject}{Qt object}. This function takes the URL of the QML file as its only argument and creates a \l Component object from this URL. @@ -113,7 +113,7 @@ created object is a visual (Qt Quick) object. The created object will become a child of the \c appWindow object in \c main.qml, and appear in the scene. When using files with relative paths, the path should -be relative to the file where \l {QML:Qt::createComponent()} +be relative to the file where \l {QtQml2::Qt::createComponent()} {Qt.createComponent()} is executed. To connect signals to (or receive signals from) dynamically created objects, @@ -127,7 +127,7 @@ It is also possible to instantiate components without blocking via the \section2 Creating an Object from a String of QML If the QML is not defined until runtime, you can create a QML object from -a string of QML using the \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()} +a string of QML using the \l{QtQml2::Qt::createQmlObject()}{Qt.createQmlObject()} function, as in the following example: \snippet qml/createQmlObject.qml 0 @@ -153,9 +153,9 @@ first, the bindings in the dynamic object will no longer work. The actual creation context depends on how an object is created: \list -\li If \l {QML:Qt::createComponent()}{Qt.createComponent()} is used, the +\li If \l {QtQml2::Qt::createComponent()}{Qt.createComponent()} is used, the creation context is the QQmlContext in which this method is called -\li If \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()} is called, the +\li If \l{QtQml2::Qt::createQmlObject()}{Qt.createQmlObject()} is called, the creation context is the context of the parent object passed to this method \li If a \c {Component{}} object is defined and \l {Component::createObject()} {createObject()} or \l {Component::incubateObject()}{incubateObject()} is @@ -221,7 +221,7 @@ Item { This would result in an error, since objects can only be dynamically destroyed if they were dynamically created. -Objects created with \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()} +Objects created with \l{QtQml2::Qt::createQmlObject()}{Qt.createQmlObject()} can similarly be destroyed using \c destroy(): \snippet qml/createQmlObject.qml 0 diff --git a/src/qml/doc/src/javascript/imports.qdoc b/src/qml/doc/src/javascript/imports.qdoc index f4d7f7d..809b74e 100644 --- a/src/qml/doc/src/javascript/imports.qdoc +++ b/src/qml/doc/src/javascript/imports.qdoc @@ -125,14 +125,14 @@ When a JavaScript file is imported, it must be imported with a qualifier. The functions in that file are then accessible from the importing script via the qualifier (that is, as \tt{Qualifier.functionName(params)}). Sometimes it is desirable to have the functions made available in the importing context without -needing to qualify them, and in this circumstance the \l{QML:Qt::include()} +needing to qualify them, and in this circumstance the \l{QtQml2::Qt::include()} {Qt.include()} function may be used to include one JavaScript file from another. This copies all functions from the other file into the current file's namespace, but ignores all pragmas and imports defined in that file. For example, the QML code below left calls \c showCalculations() in \c script.js, which in turn can call \c factorial() in \c factorial.js, as it has included -\c factorial.js using \l {QML:Qt::include()}{Qt.include()}. +\c factorial.js using \l {QtQml2::Qt::include()}{Qt.include()}. \table \row @@ -142,7 +142,7 @@ which in turn can call \c factorial() in \c factorial.js, as it has included \li \snippet qml/integrating-javascript/includejs/factorial.js 0 \endtable -Notice that calling \l {QML:Qt::include()}{Qt.include()} copies all functions +Notice that calling \l {QtQml2::Qt::include()}{Qt.include()} copies all functions from \c factorial.js into the \c MyScript namespace, which means the QML component can also access \c factorial() directly as \c MyScript.factorial(). diff --git a/src/qml/doc/src/qmltypereference.qdoc b/src/qml/doc/src/qmltypereference.qdoc index 54e10b6..f0aadba 100644 --- a/src/qml/doc/src/qmltypereference.qdoc +++ b/src/qml/doc/src/qmltypereference.qdoc @@ -93,7 +93,7 @@ MyDatePicker { minDate: "2000-01-01"; maxDate: "2020-12-31" } \endqml To read a date value returned from a C++ extension class, use -\l{QML:Qt::formatDate()}{Qt.formatDate()} and \l{QML:Qt::formatDateTime()}{Qt.formatDateTime()}. +\l{QtQml2::Qt::formatDate()}{Qt.formatDate()} and \l{QtQml2::Qt::formatDateTime()}{Qt.formatDateTime()}. When integrating with C++, note that any QDate value \l{qtqml-cppintegration-data.html}{passed into QML from C++} is automatically @@ -124,7 +124,7 @@ MyTimePicker { time: "14:22:15" } \endqml To read a time value returned from a C++ extension class, use -\l{QML:Qt::formatTime()}{Qt.formatTime()} and \l{QML:Qt::formatDateTime()}{Qt.formatDateTime()}. +\l{QtQml2::Qt::formatTime()}{Qt.formatTime()} and \l{QtQml2::Qt::formatDateTime()}{Qt.formatDateTime()}. Note that when converting historical times to and from javascript that QDateTime and the JS Date object have different methods of calculating historical daylight savings time application. This can lead to variations of one hour @@ -153,7 +153,7 @@ To create a \c point value, specify it as a "x,y" string: CustomObject { myPointProperty: "0,20" } \endqml -Or use the \l{QML:Qt::point()}{Qt.point()} function: +Or use the \l{QtQml2::Qt::point()}{Qt.point()} function: \qml CustomObject { myPointProperty: Qt.point(0, 20) } @@ -191,7 +191,7 @@ To create a \c size value, specify it as a "width x height" string: Image { sourceSize: "150x50" } \endqml -Or use the \l{QML:Qt::size()}{Qt.size()} function: +Or use the \l{QtQml2::Qt::size()}{Qt.size()} function: \qml Image { sourceSize: Qt.size(150, 50) } @@ -231,7 +231,7 @@ To create a \c rect value, specify it as a "x, y, width x height" string: CustomObject { myRectProperty: "50,50,100x100" } \endqml -Or use the \l{QML:Qt::rect()}{Qt.rect()} function: +Or use the \l{QtQml2::Qt::rect()}{Qt.rect()} function: \qml CustomObject { myRectProperty: Qt.rect(50, 50, 100, 100) } diff --git a/src/qml/doc/src/whatsnew.qdoc b/src/qml/doc/src/whatsnew.qdoc index 154c7cf..6ca979d 100644 --- a/src/qml/doc/src/whatsnew.qdoc +++ b/src/qml/doc/src/whatsnew.qdoc @@ -94,7 +94,7 @@ has now been replaced by the new \l {Qt QML} and \l {Qt Quick} modules. See the \list \li QQmlExpression can now be constructed directly (and more efficiently) from a QQmlScriptString. -\li The \l {QML:Qt} object now provides a \l{QML:Qt::inputMethod} property to access the active +\li The \l {QtQml2::Qt}{Qt} global object now provides an \l{QtQml2::Qt::inputMethod}{inputMethod} property to access the active text input method for an application. \endlist diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index 7cf7c54..73f778e 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -229,7 +229,7 @@ static inline QString buildTypeNameForDebug(const QMetaObject *metaObject) to specify how each list item is to be displayed. \c Component objects can also be created dynamically using - \l{QML:Qt::createComponent()}{Qt.createComponent()}. + \l{QtQml2::Qt::createComponent()}{Qt.createComponent()}. \section2 Creation Context diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 34ebe0a..377d0c4 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -275,8 +275,9 @@ QQmlImageProviderBase::~QQmlImageProviderBase() /*! \qmltype Qt - \instantiates QQmlEnginePrivate - \ingroup qml-utility-elements +\inqmlmodule QtQml 2 +\instantiates QQmlEnginePrivate +\ingroup qml-utility-elements \brief The QML global Qt object provides useful enums and functions from Qt. \keyword QmlGlobalQtObject diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp index 15ddcc7..194a5ca 100644 --- a/src/qml/qml/qqmllocale.cpp +++ b/src/qml/qml/qqmllocale.cpp @@ -772,10 +772,10 @@ V8_DEFINE_EXTENSION(QV8LocaleDataDeletable, localeV8Data); \inqmlmodule QtQml 2 \brief Provides locale specific properties and formatted data - The Locale object may only be created via the \l{QML:Qt::locale()}{Qt.locale()} function. + The Locale object may only be created via the \l{QtQml2::Qt::locale()}{Qt.locale()} function. It cannot be created directly. - The \l{QML:Qt::locale()}{Qt.locale()} function returns a JS Locale object representing the + The \l{QtQml2::Qt::locale()}{Qt.locale()} function returns a JS Locale object representing the locale with the specified name, which has the format "language[_territory][.codeset][@modifier]" or "C". diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp index b5f4bf5..29dba5f 100644 --- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp +++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp @@ -821,7 +821,7 @@ to \c format. The \a date parameter may be a JavaScript \c Date object, a \l{date}{date} property, a QDate, or QDateTime value. The \a format parameter may be any of the possible format values as described for -\l{QML:Qt::formatDateTime()}{Qt.formatDateTime()}. +\l{QtQml2::Qt::formatDateTime()}{Qt.formatDateTime()}. If \a format is not specified, \a date is formatted using \l {Qt::DefaultLocaleShortDate}{Qt.DefaultLocaleShortDate}. @@ -862,7 +862,7 @@ Returns a string representation of \c time, optionally formatted according to The \a time parameter may be a JavaScript \c Date object, a QTime, or QDateTime value. The \a format parameter may be any of the possible format values as -described for \l{QML:Qt::formatDateTime()}{Qt.formatDateTime()}. +described for \l{QtQml2::Qt::formatDateTime()}{Qt.formatDateTime()}. If \a format is not specified, \a time is formatted using \l {Qt::DefaultLocaleShortDate}{Qt.DefaultLocaleShortDate}. @@ -978,7 +978,7 @@ For example, if the following date/time value was specified: \endcode This \a dateTime value could be passed to \c Qt.formatDateTime(), -\l {QML:Qt::formatDate()}{Qt.formatDate()} or \l {QML:Qt::formatTime()}{Qt.formatTime()} +\l {QtQml2::Qt::formatDate()}{Qt.formatDate()} or \l {QtQml2::Qt::formatTime()}{Qt.formatTime()} with the \a format values below to produce the following results: \table @@ -1138,7 +1138,7 @@ For example, if the above snippet had misspelled color as 'colro' then the array Note that this function returns immediately, and therefore may not work if the \a qml string loads new components (that is, external QML files that have not yet been loaded). -If this is the case, consider using \l{QML:Qt::createComponent()}{Qt.createComponent()} instead. +If this is the case, consider using \l{QtQml2::Qt::createComponent()}{Qt.createComponent()} instead. See \l {Dynamic QML Object Creation from JavaScript} for more information on using this function. */ @@ -1264,7 +1264,7 @@ For example: See \l {Dynamic QML Object Creation from JavaScript} for more information on using this function. To create a QML object from an arbitrary string of QML (instead of a file), -use \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}. +use \l{QtQml2::Qt::createQmlObject()}{Qt.createQmlObject()}. */ v8::Handle createComponent(const v8::Arguments &args) { diff --git a/src/quick/doc/src/advtutorial.qdoc b/src/quick/doc/src/advtutorial.qdoc index b31b6fe..80a0173 100644 --- a/src/quick/doc/src/advtutorial.qdoc +++ b/src/quick/doc/src/advtutorial.qdoc @@ -165,7 +165,7 @@ and moves the new block to its position on the game canvas. This involves severa \list -\li \l {QML:Qt::createComponent()}{Qt.createComponent()} is called to +\li \l {QtQml2::Qt::createComponent()}{Qt.createComponent()} is called to generate a type from \c Block.qml. If the component is ready, we can call \c createObject() to create an instance of the \c Block item. diff --git a/src/quick/doc/src/concepts/positioning/righttoleft.qdoc b/src/quick/doc/src/concepts/positioning/righttoleft.qdoc index 7052de3..aec8911 100644 --- a/src/quick/doc/src/concepts/positioning/righttoleft.qdoc +++ b/src/quick/doc/src/concepts/positioning/righttoleft.qdoc @@ -139,7 +139,7 @@ The painting of these icons can be mirrored with a dedicated \c mirror property \section1 Default layout direction -The \l {QML:Qt::application}{Qt.application.layoutDirection} property can be used to query the active layout direction of the +The \l {QtQml2::Qt::application}{Qt.application.layoutDirection} property can be used to query the active layout direction of the application. It is based on QApplication::layoutDirection(), which most commonly determines the layout direction from the active language translation file. diff --git a/src/quick/doc/src/qmltypereference.qdoc b/src/quick/doc/src/qmltypereference.qdoc index 43d6b95..7e49ac0 100644 --- a/src/quick/doc/src/qmltypereference.qdoc +++ b/src/quick/doc/src/qmltypereference.qdoc @@ -78,9 +78,9 @@ In addition, the \c QtQuick module provides the following basic types: \section1 Object Types All of the object types provided by \c QtQuick are based on the \l{Item} type, -which itself derives from \l{QML::QtObject}. \l{qtqml-typereference-topic.html#object-types} +which itself derives from \l{QtQml2::QtObject}{QtObject}. \l{qtqml-typereference-topic.html#object-types} {QML object types} provided by the Qt QML module -(such as \l{QML::QtObject} and \l{QML::Component}) are also available when +(such as \l{QtQml2::QtObject}{QtObject} and \l{QtQml2::Component}{Component}) are also available when you import \c QtQuick. \section2 Visual Types @@ -311,9 +311,9 @@ For more details about the module itself, see the \l{Qt Quick} module page. \li By a hexadecimal triplet or quad in the form \c "#RRGGBB" and \c "#AARRGGBB" respectively. For example, the color red corresponds to a triplet of \c "#FF0000" and a slightly transparent blue to a quad of \c "#800000FF". - \li Using the \l{QML:Qt::rgba()}{Qt.rgba()}, \l{QML:Qt::hsla()}{Qt.hsla()}, - \l{QML:Qt::darker()}{Qt.darker()}, \l{QML:Qt::lighter()}{Qt.lighter()} or - \l{QML:Qt::tint()}{Qt.tint()} functions. + \li Using the \l{QtQml2::Qt::rgba()}{Qt.rgba()}, \l{QtQml2::Qt::hsla()}{Qt.hsla()}, + \l{QtQml2::Qt::darker()}{Qt.darker()}, \l{QtQml2::Qt::lighter()}{Qt.lighter()} or + \l{QtQml2::Qt::tint()}{Qt.tint()} functions. \endlist Example: @@ -335,7 +335,7 @@ For more details about the module itself, see the \l{Qt Quick} module page. } \endqml - To test color values for equality, use the \l{QML:Qt::colorEqual()}{Qt.colorEqual()} + To test color values for equality, use the \l{QtQml2::Qt::colorEqual()}{Qt.colorEqual()} function. This allows colors to be accurately compared whether they are in property form or in any of the acceptable string specification forms. @@ -576,7 +576,7 @@ console.log(c + " " + d); // false true Rotation { angle: 60; axis: "0,1,0" } \endqml - or with the \l{QML:Qt::vector3d()}{Qt.vector3d()} function: + or with the \l{QtQml2::Qt::vector3d()}{Qt.vector3d()} function: \qml Rotation { angle: 60; axis: Qt.vector3d(0, 1, 0) } -- 2.7.4