summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-07-03 05:34:22 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-07-03 05:34:22 (GMT)
commit2283f0d39dfc0ffde1ac5fdb2928a534e164bef3 (patch)
tree68a3cd88a0daad1b3821ca5332284279e9dd42b5
parent3320e130954229d513be62f7d6a6410ca5e5f523 (diff)
downloadQt-2283f0d39dfc0ffde1ac5fdb2928a534e164bef3.zip
Qt-2283f0d39dfc0ffde1ac5fdb2928a534e164bef3.tar.gz
Qt-2283f0d39dfc0ffde1ac5fdb2928a534e164bef3.tar.bz2
Doc
-rw-r--r--doc/src/declarative/components.qdoc92
-rw-r--r--doc/src/declarative/qmlforcpp.qdoc55
-rw-r--r--doc/src/declarative/qtdeclarative.qdoc4
3 files changed, 2 insertions, 149 deletions
diff --git a/doc/src/declarative/components.qdoc b/doc/src/declarative/components.qdoc
deleted file mode 100644
index d7a4ba6..0000000
--- a/doc/src/declarative/components.qdoc
+++ /dev/null
@@ -1,92 +0,0 @@
-/*!
-\page components.html
-\target components
-\title Components
-
-A \bold component is a reusable, encapsulated Qml element with a well-defined interface.
-
-Writing and using components allows you to:
-\list
-\o Reuse sections of Qml without copy-and-paste.
-\o Have consistent Look and Feel between different parts of your UI.
-\o Create new Qml elements without writing a new C++ class. (See \l {cppitem}{Creating Qml elements in C++})
-\endlist
-
-Components are placed in \e <Name>.qml files, allowing \e <Name> to then be used as a tag
-elsewhere. For example, if you have a Slider.qml file, you can then use \c {Slider { ... }} to
-make a slider, just as if it was a built-in type.
-
-Components may be collected into \l {qmlmodules}{modules}.
-
-\section1 Example: Creating a MyButton Component
-
-This example describes how to create a component from an existing snippet of Qml.
-
-Assume you have an existing UI with a single 'Save' button, defined as follows:
-
-\code
-Image {
- source: "pics/button-background.png"
- Text {
- text: "Save"
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- }
- MouseRegion {
- anchors.fill: parent
- onClick: { saveData() }
- }
-}
-\endcode
-
-For the next release, you plan to add 'Cancel' and 'Reset' buttons. Rather than copying and pasting the above markup, you can create a component:
-
-\list 1
-\o Create a file called MyButton.qml, and copy the relevant Qml snippet into that file.
-\o Make some minor changes to define the component's interface:
-
-\code
-Image {
- property string label
- signal clicked
- source: "pics/button-background.png"
- Text {
- text: parent.label
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- }
- MouseRegion {
- anchors.fill: parent
- onClick: { parent.click.emit() }
- }
-}
-\endcode
-
-The \a label property and \a click signal that were added effectively become part of the 'public API' of the MyButton component. In a similar manner, the Text and MouseRegion elements become invisible to anyone using the component. Note that the Text element now binds in its data from \a label, and the MouseRegion emits a generic signal.
-
-\o The component can now be used elsewhere as MyButton:
-
-\code
-MyButton { label: "Save"; onClicked: saveData() }
-...
-MyButton { label: "Cancel"; onClicked: cancelData() }
-...
-MyButton { label: "Reset"; onClicked: resetData() }
-\endcode
-
-\endlist
-
-\section1 Placing .qml Files
-
-When one component refers to a another, the second must be found either in the same directory
-as the first, or in a directory imported using the \c import statement:
-
-\code
-import "library"
-\endcode
-
-\section1 Namespaces
-
-Namespaces for QML will be supported in Qt 4.6.
-
-*/
diff --git a/doc/src/declarative/qmlforcpp.qdoc b/doc/src/declarative/qmlforcpp.qdoc
index c95cb71..38f5665 100644
--- a/doc/src/declarative/qmlforcpp.qdoc
+++ b/doc/src/declarative/qmlforcpp.qdoc
@@ -567,61 +567,6 @@
engine will automatically set the property as the target of the value
source.
- \section1 Extending types in QML
-
- QML is designed to allow you to build fully working types without writing
- a line of C++ code. This is, for example, used extensively when designing
- applications using the Fluid UI primitives. To create new types, it is
- necessary to be able to define new signals, slots and properties in QML.
-
- In this example, a Button is extended to have an additional
- "text2" property (which always returns "Hello world!") and an additional
- signal "clicked2" that is also emitted when the button is clicked. Not
- a very useful extension, but an extension nonetheless.
-
- \table
- \row
- \o
- \code
- QmlEngine engine;
- QmlComponent component(&engine, qmlData);
- QObject *object = component.create();
- // Will print "Hello world!"
- qDebug() << object->property("text2");
- // Will be emitted whenever the button is clicked
- QObject::connect(object, SIGNAL(clicked2()), this, SLOT(...));
- \endcode
- \o
- \code
- Button {
- property string text2
- signal clicked2
-
- text: "Hello!"
- text2: "Hello world!"
- onClicked: clicked2.emit()
- }
- \endcode
- \endtable
-
- The general syntax for defining new properties and signals is:
-
- \list
- \o
- \code
- [default] property <type> <name> [: <default value>]
- \endcode
-
- Where type can be one of \e int, \e bool, \e double, \e real, \e string,
- \e color, \e date, \e var or \e variant.
-
- \o
- \code
- signal <name>
- \endcode
- Currently only parameterless signals are supported.
- \endlist
-
\section1 Parser Status
Generally using QML is a breeze - you implement your classes in C++, add
diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc
index 4fe9994..c945b24 100644
--- a/doc/src/declarative/qtdeclarative.qdoc
+++ b/doc/src/declarative/qtdeclarative.qdoc
@@ -68,15 +68,15 @@
\o \l {qmlforcpp}{QML For C++ Programmers}
\endlist
- Core Features:
+ Core QML Features:
\list
\o \l {binding}{Data Binding}
\o \l {anchor-layout}{Layout Anchors}
\o \l {qmlanimation}{Animation}
\o \l {qmleffects}{Visual Effects}
- \o \l {components}{Components}
\o \l {qmlmodules}{Modules}
\o \l {qmlfocus}{Keyboard Focus}
+ \o \l {Extending types from QML}
\endlist
QML Reference: