summaryrefslogtreecommitdiffstats
path: root/doc/src/declarative
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2010-04-21 07:14:07 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2010-04-21 07:14:07 (GMT)
commitd420eb68b9a306f0fccf3000a8af31aa00cb0cd9 (patch)
tree44c958741cd0189acd5ac875d57d28165f051aae /doc/src/declarative
parent202af3021362d3c8066bc479a95e7aad889bd928 (diff)
parentb72f9dacb352aa4be888c5f7f1a482dbcba1f456 (diff)
downloadQt-d420eb68b9a306f0fccf3000a8af31aa00cb0cd9.zip
Qt-d420eb68b9a306f0fccf3000a8af31aa00cb0cd9.tar.gz
Qt-d420eb68b9a306f0fccf3000a8af31aa00cb0cd9.tar.bz2
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'doc/src/declarative')
-rw-r--r--doc/src/declarative/advtutorial.qdoc22
-rw-r--r--doc/src/declarative/codingconventions.qdoc1
-rw-r--r--doc/src/declarative/declarativeui.qdoc2
-rw-r--r--doc/src/declarative/examples.qdoc39
-rw-r--r--doc/src/declarative/extending.qdoc64
-rw-r--r--doc/src/declarative/globalobject.qdoc78
-rw-r--r--doc/src/declarative/propertybinding.qdoc56
-rw-r--r--doc/src/declarative/qdeclarativemodels.qdoc12
-rw-r--r--doc/src/declarative/qdeclarativereference.qdoc4
-rw-r--r--doc/src/declarative/qdeclarativesecurity.qdoc4
-rw-r--r--doc/src/declarative/qtdeclarative.qdoc55
11 files changed, 247 insertions, 90 deletions
diff --git a/doc/src/declarative/advtutorial.qdoc b/doc/src/declarative/advtutorial.qdoc
index 751bf00..c465da4 100644
--- a/doc/src/declarative/advtutorial.qdoc
+++ b/doc/src/declarative/advtutorial.qdoc
@@ -67,7 +67,7 @@ Tutorial chapters:
\list 1
\o \l {QML Advanced Tutorial 1 - Creating the Game Canvas and Blocks}{Creating the Game Canvas and Blocks}
-\o \l {QML Advanced Tutorial 2 - Populating the Game Canvas}{Populating the Game Canvas}}
+\o \l {QML Advanced Tutorial 2 - Populating the Game Canvas}{Populating the Game Canvas}
\o \l {QML Advanced Tutorial 3 - Implementing the Game Logic}{Implementing the Game Logic}
\o \l {QML Advanced Tutorial 4 - Finishing Touches}{Finishing Touches}
\endlist
@@ -83,10 +83,6 @@ directory.
\previouspage QML Advanced Tutorial
\nextpage QML Advanced Tutorial 2 - Populating the Game Canvas
-In this chapter:
-
-\tableofcontents
-
The files referenced on this page can be found in \c $QTDIR\examples\tutorials\samegame\samegame1.
\section2 Creating the application screen
@@ -109,7 +105,7 @@ is the \l SystemPalette item. This provides access to the Qt system palette
and is used to give the button a more native look-and-feel.
Notice the anchors for the \c Item, \c Button and \c Text elements are set using
-\l {Grouped Properties}{group notation} for readability.
+\l {codingconventions.html#Grouped-properties}{group notation} for readability.
\section2 Adding \c Button and \c Block components
@@ -152,10 +148,6 @@ elements to get started. Next, we will populate the game canvas with some blocks
\previouspage QML Advanced Tutorial 1 - Creating the Game Canvas and Blocks
\nextpage QML Advanced Tutorial 3 - Implementing the Game Logic
-In this chapter:
-
-\tableofcontents
-
The files referenced on this page can be found in \c $QTDIR\examples\tutorials\samegame\samegame2.
@@ -224,10 +216,6 @@ Now, we have a screen of blocks, and we can begin to add the game mechanics.
\previouspage QML Advanced Tutorial 2 - Populating the Game Canvas
\nextpage QML Advanced Tutorial 4 - Finishing Touches
-In this chapter:
-
-\tableofcontents
-
The files referenced on this page can be found in \c $QTDIR\examples\tutorials\samegame\samegame3.
\section2 Making a playable game
@@ -313,10 +301,6 @@ until the next chapter - where your application becomes alive!
\contentspage QML Advanced Tutorial
\previouspage QML Advanced Tutorial 3 - Implementing the Game Logic
-In this chapter:
-
-\tableofcontents
-
The files referenced on this page can be found in \c $QTDIR\examples\tutorials\samegame\samegame4.
\section2 Adding some flair
@@ -432,7 +416,7 @@ If the player enters a name, we send the data to the service using this code in
\snippet declarative/tutorials/samegame/samegame4/content/samegame.js 1
-The \c XMLHttpRequest in this code is the same \c XMLHttpRequest() as you'll find in standard browser JavaScript, and can be used in the same way to dynamically get XML
+The \l XMLHttpRequest in this code is the same as the \c XMLHttpRequest() as you'll find in standard browser JavaScript, and can be used in the same way to dynamically get XML
or QML from the web service to display the high scores. We don't worry about the response in this case - we just post the high
score data to the web server. If it had returned a QML file (or a URL to a QML file) you could instantiate it in much the same
way as you did with the blocks.
diff --git a/doc/src/declarative/codingconventions.qdoc b/doc/src/declarative/codingconventions.qdoc
index 7ae5cbd..7ca206b 100644
--- a/doc/src/declarative/codingconventions.qdoc
+++ b/doc/src/declarative/codingconventions.qdoc
@@ -72,6 +72,7 @@ For example, a hypothetical \e photo QML object would look like this:
\snippet doc/src/snippets/declarative/codingconventions/photo.qml 0
+\target Grouped properties
\section1 Grouped properties
If using multiple properties from a group of properties,
diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc
index a2a5283..55945e6 100644
--- a/doc/src/declarative/declarativeui.qdoc
+++ b/doc/src/declarative/declarativeui.qdoc
@@ -75,7 +75,7 @@ completely new applications. QML is fully \l {Extending QML in C++}{extensible
\o \l {Introduction to the QML language}
\o \l {QML Tutorial}{Tutorial: 'Hello World'}
\o \l {QML Advanced Tutorial}{Tutorial: 'Same Game'}
-\o \l {QML Examples and Walkthroughs}
+\o \l {QML Examples and Demos}
\o \l {Using QML in C++ Applications}
\o \l {QML for Qt programmers}
\endlist
diff --git a/doc/src/declarative/examples.qdoc b/doc/src/declarative/examples.qdoc
index 3d8325e..dc6b76c 100644
--- a/doc/src/declarative/examples.qdoc
+++ b/doc/src/declarative/examples.qdoc
@@ -41,18 +41,22 @@
/*!
\page qdeclarativeexamples.html
-\title QML Examples and Walkthroughs
+\title QML Examples and Demos
-\section1 Running Examples and Demos
+\previouspage Graphics View Examples
+\contentspage Qt Examples
+\nextpage Painting Examples
+
+\section1 Running the examples
You can find many simple examples in the \c examples/declarative
sub-directory that show how to use various aspects of QML. In addition, the
\c demos/declarative sub-directory contains more sophisticated demos of large
applications. These demos are intended to show integrated functionality
-rather than being instructive on specifice elements.
+rather than being instructive on specific elements.
-To run the examples and demos, use the included \l {Qt Declarative UI Runtime}{qml}
-application. It has some useful options, revealed by:
+To run the examples and demos, you can use Qt Creator or the included \l {Qt Declarative UI Runtime}{qml}
+command-line application. It has some useful options, revealed by:
\code
bin/qml -help
@@ -66,18 +70,19 @@ For example, from your build directory, run:
\section1 Examples
-These will be documented, and demonstrate how to achieve various things in QML.
+\list
+\o \l{declarative/focus}{Focus}
+\endlist
+
+\section1 Demos
-\table
-\row
- \o Elastic Dial
- \o \image dial-example.gif
-\row
- \o \l{qdeclarativeexampletoggleswitch.html}{Toggle Switch}
- \o \image switch-example.gif
-\row
- \o \l{QML Advanced Tutorial}{SameGame}
- \o \image declarative-adv-tutorial4.gif
-\endtable
+\list
+\o \l{demos/declarative/calculator}{Calculator}
+\o \l{demos/declarative/minehunt}{Minehunt}
+\o \l{demos/declarative/photoviewer}{Photo Viewer}
+\o \l{demos/declarative/flickr}{Flickr Mobile}
+\o \l{demos/declarative/samegame}{Same Game}
+\o \l{demos/declarative/snake}{Snake}
+\endlist
*/
diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc
index a1d8a10..c27d091 100644
--- a/doc/src/declarative/extending.qdoc
+++ b/doc/src/declarative/extending.qdoc
@@ -59,7 +59,7 @@ QML for their own independent use.
\snippet examples/declarative/extending/adding/example.qml 0
The QML snippet shown above instantiates one \c Person instance and sets
-the name and shoeSize properties on it. Everything in QML ultimately comes down
+the \c name and \c shoeSize properties on it. Everything in QML ultimately comes down
to either instantiating an object instance, or assigning a property a value.
QML relies heavily on Qt's meta object system and can only instantiate classes
that derive from QObject.
@@ -124,7 +124,7 @@ the \c Person type.
\snippet examples/declarative/extending/properties/example.qml 0
The QML snippet shown above assigns a \c Person object to the \c BirthdayParty's
-celebrant property, and assigns three \c Person objects to the guests property.
+\c host property, and assigns three \c Person objects to the guests property.
QML can set properties of types that are more complex than basic intrinsics like
integers and strings. Properties can also be object pointers, Qt interface
@@ -133,12 +133,12 @@ is typesafe it ensures that only valid types are assigned to these properties,
just like it does for primitive types.
Properties that are pointers to objects or Qt interfaces are declared with the
-Q_PROPERTY() macro, just like other properties. The celebrant property
+Q_PROPERTY() macro, just like other properties. The \c host property
declaration looks like this:
\snippet examples/declarative/extending/properties/birthdayparty.h 1
-As long as the property type, in this case Person, is registered with QML the
+As long as the property type, in this case \c Person, is registered with QML the
property can be assigned.
QML also supports assigning Qt interfaces. To assign to a property whose type
@@ -158,12 +158,12 @@ Following registration, QML can coerce objects that implement this interface
for assignment to appropriately typed properties.
\endquotation
-The guests property is a list of \c Person objects. Properties that are lists
+The \c guests property is a list of \c Person objects. Properties that are lists
of objects or Qt interfaces are also declared with the Q_PROPERTY() macro, just
like other properties. List properties must have the type \c {QDeclarativeListProperty<T>}.
As with object properties, the type \a T must be registered with QML.
-The guest property declaration looks like this:
+The \c guest property declaration looks like this:
\snippet examples/declarative/extending/properties/birthdayparty.h 2
@@ -175,14 +175,14 @@ code used to create the \c BirthdayParty type.
\snippet examples/declarative/extending/coercion/example.qml 0
The QML snippet shown above assigns a \c Boy object to the \c BirthdayParty's
-celebrant property, and assigns three other objects to the guests property.
+\c host property, and assigns three other objects to the \c guests property.
-QML supports C++ inheritance heirarchies and can freely coerce between known,
+QML supports C++ inheritance hierarchies and can freely coerce between known,
valid object types. This enables the creation of common base classes that allow
the assignment of specialized classes to object or list properties. In the
-snippet shown, both the celebrant and the guests properties retain the Person
-type used in the previous section, but the assignment is valid as both the Boy
-and Girl objects inherit from Person.
+snippet shown, both the \c host and the \c guests properties retain the \c Person
+type used in the previous section, but the assignment is valid as both the \c Boy
+and \c Girl objects inherit from \c Person.
To assign to a property, the property's type must have been registered with QML.
Both the qmlRegisterType() and qmlRegisterInterface() template functions already
@@ -219,7 +219,7 @@ code used to create the \c Boy and \c Girl types.
The QML snippet shown above assigns a collection of objects to the
\c BirthdayParty's default property.
-The default property is a syntactic convenience that allows a type designer to
+The \e {default property} is a syntactic convenience that allows a type designer to
specify a single property as the type's default. The default property is
assigned to whenever no explicit property is specified. As a convenience, it is
behaviorally identical to assigning the default property explicitly by name.
@@ -257,12 +257,12 @@ may also simplify the implementation of common property collections across
different types through implementation reuse.
A grouped property block is implemented as a read-only object property. The
-shoe property shown is declared like this:
+\c shoe property shown is declared like this:
\snippet examples/declarative/extending/grouped/person.h 1
-The ShoeDescription type declares the properties available to the grouped
-property block - in this case the size, color, brand and price properties.
+The \c ShoeDescription type declares the properties available to the grouped
+property block - in this case the \c size, \c color, \c brand and \c price properties.
Grouped property blocks may declared and accessed be recusively.
@@ -273,7 +273,7 @@ implement the \c shoe property grouping.
\snippet examples/declarative/extending/attached/example.qml 1
-The QML snippet shown above assigns the rsvp property using the attached
+The QML snippet shown above assigns the \c rsvp property using the attached
property syntax.
Attached properties allow unrelated types to annotate other types with some
@@ -282,7 +282,7 @@ identified through the use of the attacher type name, in the case shown
\c BirthdayParty, as a suffix to the property name.
In the example shown, \c BirthdayParty is called the attaching type, and the
-Boy instance the attachee object instance.
+\c Boy instance the attachee object instance.
For the attaching type, an attached property block is implemented as a new
QObject derived type, called the attachment object. The properties on the
@@ -326,7 +326,7 @@ their effect may be so limited.
For example, a common usage scenario is for a type to enhance the properties
available to its children in order to gather instance specific data. Here we
-add a rsvp field to all the guests coming to a birthday party:
+add a \c rsvp field to all the guests coming to a birthday party:
\code
BirthdayParty {
Boy { BirthdayParty.rsvp: "2009-06-01" }
@@ -362,7 +362,7 @@ implement the rsvp attached property.
\section1 Memory Management and QVariant types
-It is an elements responsibility to ensure that it does not access or return
+It is an element's responsibility to ensure that it does not access or return
pointers to invalid objects. QML makes the following guarentees:
\list
@@ -427,7 +427,7 @@ implement the onPartyStarted signal property.
\snippet examples/declarative/extending/valuesource/example.qml 0
\snippet examples/declarative/extending/valuesource/example.qml 1
-The QML snippet shown above assigns a property value to the speaker property.
+The QML snippet shown above applies a property value source to the \c announcment property.
A property value source generates a value for a property that changes over time.
Property value sources are most commonly used to do animation. Rather than
@@ -435,9 +435,9 @@ constructing an animation object and manually setting the animation's "target"
property, a property value source can be assigned directly to a property of any
type and automatically set up this association.
-The example shown here is rather contrived: the speaker property of the
-BirthdayParty object is a string that is printed every time it is assigned and
-the HappyBirthday value source generates the lyrics of the song
+The example shown here is rather contrived: the \c announcment property of the
+\c BirthdayParty object is a string that is printed every time it is assigned and
+the \c HappyBirthdaySong value source generates the lyrics of the song
"Happy Birthday".
\snippet examples/declarative/extending/valuesource/birthdayparty.h 0
@@ -451,11 +451,11 @@ Property value sources are special types that derive from the
QDeclarativePropertyValueSource base class. This base class contains a single method,
QDeclarativePropertyValueSource::setTarget(), that the QML engine invokes when
associating the property value source with a property. The relevant part of
-the HappyBirthday type declaration looks like this:
+the \c HappyBirthdaySong type declaration looks like this:
-\snippet examples/declarative/extending/valuesource/happybirthday.h 0
-\snippet examples/declarative/extending/valuesource/happybirthday.h 1
-\snippet examples/declarative/extending/valuesource/happybirthday.h 2
+\snippet examples/declarative/extending/valuesource/happybirthdaysong.h 0
+\snippet examples/declarative/extending/valuesource/happybirthdaysong.h 1
+\snippet examples/declarative/extending/valuesource/happybirthdaysong.h 2
In all other respects, property value sources are regular QML types. They must
be registered with the QML engine using the same macros as other types, and can
@@ -463,11 +463,11 @@ contain properties, signals and methods just like other types.
When a property value source object is assigned to a property, QML first tries
to assign it normally, as though it were a regular QML type. Only if this
-assignment fails does the engine call the setTarget() method. This allows
+assignment fails does the engine call the \l {QDeclarativePropertyValueSource::}{setTarget()} method. This allows
the type to also be used in contexts other than just as a value source.
\l {Extending QML - Property Value Source Example} shows the complete code used
-implement the HappyBirthday property value source.
+implement the \c HappyBirthdaySong property value source.
\section1 Property Binding
@@ -475,7 +475,7 @@ implement the HappyBirthday property value source.
\snippet examples/declarative/extending/binding/example.qml 1
The QML snippet shown above uses a property binding to ensure the
-HappyBirthday's name property remains up to date with the celebrant.
+\c HappyBirthdaySong's \c name property remains up to date with the \c host.
Property binding is a core feature of QML. In addition to assigning literal
values, property bindings allow the developer to assign an arbitrarily complex
@@ -488,9 +488,9 @@ All properties on custom types automatically support property binding. However,
for binding to work correctly, QML must be able to reliably determine when a
property has changed so that it knows to reevaluate any bindings that depend on
the property's value. QML relies on the presence of a
-\c {Qt's Property System}{NOTIFY signal} for this determination.
+\l {Qt's Property System}{NOTIFY signal} for this determination.
-Here is the celebrant property declaration:
+Here is the \c host property declaration:
\snippet examples/declarative/extending/binding/birthdayparty.h 0
diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc
index e2152b3..d729d4f 100644
--- a/doc/src/declarative/globalobject.qdoc
+++ b/doc/src/declarative/globalobject.qdoc
@@ -293,11 +293,81 @@ of their use.
been loaded, and so it is safe to use createQmlObject to load built-in
components.
-\section1 Asynchronous JavaScript and XML
-QML script supports the XMLHttpRequest object, which can be used to asynchronously obtain data from over a network.
-\section2 XMLHttpRequest()
-In QML you can construct an XMLHttpRequest object just like in a web browser! TODO: Real documentation for this object.
+\section1 XMLHttpRequest
+\target XMLHttpRequest
+
+QML script supports the XMLHttpRequest object, which can be used to asynchronously obtain
+data from over a network.
+
+The XMLHttpRequest API implements the same \l {http://www.w3.org/TR/XMLHttpRequest/}{W3C standard}
+as many popular web browsers with following exceptions:
+\list
+\i QML's XMLHttpRequest does not enforce the same origin policty.
+\i QML's XMLHttpRequest does not support \e synchronous requests.
+\endlist
+
+Additionally, the \c responseXML XML DOM tree currently supported by QML is a reduced subset
+of the \l {http://www.w3.org/TR/DOM-Level-3-Core/}{DOM Level 3 Core} API supported in a web
+browser. The following objects and properties are supported by the QML implementation:
+
+\table
+\header
+\o \bold {Node}
+\o \bold {Document}
+\o \bold {Element}
+\o \bold {Attr}
+\o \bold {CharacterData}
+\o \bold {Text}
+
+\row
+\o
+\list
+\o nodeName
+\o nodeValue
+\o nodeType
+\o parentNode
+\o childNodes
+\o firstChild
+\o lastChild
+\o previousSibling
+\o nextSibling
+\o attribtes
+\endlist
+
+\o
+\list
+\o xmlVersion
+\o xmlEncoding
+\o xmlStandalone
+\o documentElement
+\endlist
+
+\o
+\list
+\o tagName
+\endlist
+
+\o
+\list
+\o name
+\o value
+\o ownerElement
+\endlist
+
+\o
+\list
+\o data
+\o length
+\endlist
+
+\o
+\list
+\o isElementContentWhitespace
+\o wholeText
+\endlist
+
+\endtable
\section1 Offline Storage API
diff --git a/doc/src/declarative/propertybinding.qdoc b/doc/src/declarative/propertybinding.qdoc
index 02f9868..ab3682d 100644
--- a/doc/src/declarative/propertybinding.qdoc
+++ b/doc/src/declarative/propertybinding.qdoc
@@ -78,16 +78,52 @@ Rectangle {
}
\endcode
-Being JavaScript expressions, bindings are evaluated in a scope chain. The \l {QML Scope}
-documentation covers the specifics of scoping in QML.
-
-\list
-\o When does a binding not get updated?
-\o Scope
-\o Assigning a constant/other binding clears existing binding
-\o Loops
-\o Using model data
-\endlist
+While syntactically bindings can be of arbitrary complexity, if a binding starts to become
+overly complex - such as involving multiple lines, or imperative loops - it may be better
+to refactor the component entirely, or at least factor the binding out into a separate
+function.
+
+\section1 Changing Bindings
+
+The \l PropertyChanges element can be used within a state change to modify the bindings on
+properties.
+
+This example modifies the \l Rectangle's width property binding to be \c {otherItem.height}
+when in the "square" state. When it returns to its default state, width's original property
+binding will have been restored.
+
+\code
+Rectangle {
+ id: rectangle
+ width: otherItem.width
+ height: otherItem.height
+
+ states: State {
+ name: "square"
+ PropertyChanges {
+ target: rectangle
+ width: otherItem.height
+ }
+ }
+}
+\endcode
+
+Imperatively assigning a value directly to a property will also implicitly remove a binding
+on a property. A property can only have one value at a time, and if code explicitly sets
+this value the binding must be removed. The \l Rectangle in the example below will have
+a width of 13, regardless of the otherItem's width.
+
+\code
+Rectangle {
+ width: otherItem.width
+
+ Component.onCompleted: {
+ width = 13;
+ }
+}
+\endcode
+
+There is no way to create a property binding directly from imperative JavaScript code.
\section1 Binding Element
diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc
index d8b2a5d..eecc117 100644
--- a/doc/src/declarative/qdeclarativemodels.qdoc
+++ b/doc/src/declarative/qdeclarativemodels.qdoc
@@ -206,8 +206,16 @@ The default role names set by Qt are:
\endtable
QAbstractItemModel presents a heirachy of tables. Views currently provided by QML
-can only display list data. In order to display child lists of a heirachical model
-use the VisualDataModel element with \e rootIndex set to a parent node.
+can only display list data.
+In order to display child lists of a heirachical model
+the VisualDataModel element provides several properties and functions for use
+with models of type QAbstractItemModel:
+\list
+\o \e hasModelChildren role property to determine whether a node has child nodes.
+\o \l VisualDataModel::rootIndex allows the root node to be specifed
+\o \l VisualDataModel::modelIndex() returns a QModelIndex which can be assigned to VisualDataModel::rootIndex
+\o \l VisualDataModel::parentModelIndex() returns a QModelIndex which can be assigned to VisualDataModel::rootIndex
+\endlist
\section2 QStringList
diff --git a/doc/src/declarative/qdeclarativereference.qdoc b/doc/src/declarative/qdeclarativereference.qdoc
index b2cfba8..4c1f449 100644
--- a/doc/src/declarative/qdeclarativereference.qdoc
+++ b/doc/src/declarative/qdeclarativereference.qdoc
@@ -55,7 +55,7 @@
That is, you specify \e what the UI should look like and how it should behave
rather than specifying step-by-step \e how to build it. Specifying a UI declaratively
does not just include the layout of the interface items, but also the way each
- individual item looks and behaves and the overall flow of the application.
+ individual item looks and behaves and the overall flow of the application.
The QML elements provide a sophisticated set of graphical and behavioral building
blocks. These different elements are combined together in \l {QML Documents}{QML documents} to build components
@@ -67,7 +67,7 @@
\o \l {Introduction to the QML language}
\o \l {QML Tutorial}{Tutorial: 'Hello World'}
\o \l {QML Advanced Tutorial}{Advanced Tutorial: 'Same Game'}
- \o \l {QML Examples and Walkthroughs}
+ \o \l {QML Examples and Demos}
\endlist
\section1 Core QML Features:
diff --git a/doc/src/declarative/qdeclarativesecurity.qdoc b/doc/src/declarative/qdeclarativesecurity.qdoc
index 290d78f..91d6d87 100644
--- a/doc/src/declarative/qdeclarativesecurity.qdoc
+++ b/doc/src/declarative/qdeclarativesecurity.qdoc
@@ -72,7 +72,7 @@ A non-exhaustive list of the ways you could shoot yourself in the foot is:
\list
\i Using \c import to import QML or JavaScript you do not control. BAD
\i Using \l Loader to import QML you do not control. BAD
- \i Using \l{XMLHttpRequest()}{XMLHttpRequest} to load data you do not control and executing it. BAD
+ \i Using \l{XMLHttpRequest}{XMLHttpRequest} to load data you do not control and executing it. BAD
\endlist
However, the above does not mean that you have no use for the network transparency of QML.
@@ -81,7 +81,7 @@ There are many good and useful things you \e can do:
\list
\i Create \l Image elements with source URLs of any online images. GOOD
\i Use XmlListModel to present online content. GOOD
- \i Use \l{XMLHttpRequest()}{XMLHttpRequest} to interact with online services. GOOD
+ \i Use \l{XMLHttpRequest}{XMLHttpRequest} to interact with online services. GOOD
\endlist
The only reason this page is necessary at all is that JavaScript, when run in a \e{web browser},
diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc
index b4d8a2e..5d1e18f 100644
--- a/doc/src/declarative/qtdeclarative.qdoc
+++ b/doc/src/declarative/qtdeclarative.qdoc
@@ -79,7 +79,7 @@
\relates QDeclarativeEngine
This template function registers the C++ type in the QML system with
- the name \a qmlName. in the library imported from \a uri having the
+ the name \a qmlName, in the library imported from \a uri having the
version number composed from \a versionMajor and \a versionMinor.
Returns the QML type id.
@@ -94,6 +94,59 @@
*/
/*!
+ \fn int qmlRegisterUncreatableType(const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& message)
+ \relates QDeclarativeEngine
+
+ This template function registers the C++ type in the QML system with
+ the name \a qmlName, in the library imported from \a uri having the
+ version number composed from \a versionMajor and \a versionMinor.
+
+ While the type has a name and a type, it cannot be created, and the
+ given error \a message will result if creation is attempted.
+
+ This is useful where the type is only intended for providing attached properties or enum values.
+
+ Returns the QML type id.
+
+ \sa qmlRegisterTypeNotAvailable
+*/
+
+/*!
+ \fn int qmlRegisterTypeNotAvailable(const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& message)
+ \relates QDeclarativeEngine
+
+ This function registers a type in the QML system with the name \a qmlName, in the library imported from \a uri having the
+ version number composed from \a versionMajor and \a versionMinor, but any attempt to instantiate the type
+ will produce the given error \a message.
+
+ Normally, the types exported by a module should be fixed. However, if a C++ type is not available, you should
+ at least "reserve" the QML type name, and give the user of your module a meaningful error message.
+
+ Returns the QML type id.
+
+ Example:
+
+ \code
+ #ifdef NO_GAMES_ALLOWED
+ qmlRegisterTypeNotAvailable("MinehuntCore", 0, 1, "Game", "Get back to work, slacker!");
+ #else
+ qmlRegisterType<MinehuntGame>("MinehuntCore", 0, 1, "Game");
+ #endif
+ \endcode
+
+ This will cause any QML which uses this module and attempts to use the type to produce an error message:
+ \code
+fun.qml: Get back to work, slacker!
+ Game {
+ ^
+ \endcode
+
+ Without this, a generic "Game is not a type" message would be given.
+
+ \sa qmlRegisterUncreatableType
+*/
+
+/*!
\fn int qmlRegisterType()
\relates QDeclarativeEngine
\overload