diff options
author | Andy Shaw <andy.shaw@nokia.com> | 2010-06-03 09:59:18 (GMT) |
---|---|---|
committer | Andy Shaw <andy.shaw@nokia.com> | 2010-06-03 09:59:18 (GMT) |
commit | 8d33b335e9cc198a95bf0d180f4daefd57134bd3 (patch) | |
tree | b053d5cd7539c6401abe5f7cb969d4114b6af235 /doc | |
parent | 41f57bd5eba433676b52d4f8dfebe5e671ba48e5 (diff) | |
parent | a8829a52d65a9759d5dffe98fb07b384c54db1c8 (diff) | |
download | Qt-8d33b335e9cc198a95bf0d180f4daefd57134bd3.zip Qt-8d33b335e9cc198a95bf0d180f4daefd57134bd3.tar.gz Qt-8d33b335e9cc198a95bf0d180f4daefd57134bd3.tar.bz2 |
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Diffstat (limited to 'doc')
16 files changed, 408 insertions, 467 deletions
diff --git a/doc/src/declarative/basictypes.qdoc b/doc/src/declarative/basictypes.qdoc index 43ae214..87dab81 100644 --- a/doc/src/declarative/basictypes.qdoc +++ b/doc/src/declarative/basictypes.qdoc @@ -40,363 +40,377 @@ ****************************************************************************/ /*! - \page qdeclarativebasictypes.html - \title QML Basic Types + \page qdeclarativebasictypes.html + \title QML Basic Types - QML has a set of primitive types, as listed below, that are used throughout - the \l {QML Elements}. + QML has a set of primitive types, as listed below, that are used throughout + the \l {QML Elements}. - Some of these types can also be used for defining - \c property values in QML. See \l{Extending types from QML} for the - list of types that can be used for \c property values. + Some of these types can also be used for defining + \c property values in QML. See \l{Extending types from QML} for the + list of types that can be used for \c property values. - \annotatedlist qmlbasictypes + \annotatedlist qmlbasictypes */ /*! - \qmlbasictype int - \ingroup qmlbasictypes + \qmlbasictype int + \ingroup qmlbasictypes - \brief An integer is a whole number, e.g. 0, 10, or -20. + \brief An integer is a whole number, e.g. 0, 10, or -20. - An integer is a whole number, e.g. 0, 10, or -20. The possible \c - int values range from around -2000000000 to around 2000000000, - although most elements will only accept a reduced range (which they - mention in their documentation). + An integer is a whole number, e.g. 0, 10, or -20. The possible \c + int values range from around -2000000000 to around 2000000000, + although most elements will only accept a reduced range (which they + mention in their documentation). - Example: - \qml - Item { width: 100; height: 200 } - \endqml + Example: + \qml + Item { width: 100; height: 200 } + \endqml - \sa {QML Basic Types} + \sa {QML Basic Types} */ /*! - \qmlbasictype bool - \ingroup qmlbasictypes + \qmlbasictype bool + \ingroup qmlbasictypes - \brief A boolean is a binary true/false value. + \brief A boolean is a binary true/false value. - A boolean is a binary true/false value. + A boolean is a binary true/false value. - Example: - \qml - Item { focus: true; clip: false } - \endqml + Example: + \qml + Item { focus: true; clip: false } + \endqml - \sa {QML Basic Types} + \sa {QML Basic Types} */ /*! - \qmlbasictype real - \ingroup qmlbasictypes + \qmlbasictype real + \ingroup qmlbasictypes - \brief A real number has a decimal point, e.g. 1.2 or -29.8. + \brief A real number has a decimal point, e.g. 1.2 or -29.8. - A real number has a decimal point, e.g. 1.2 or -29.8. + A real number has a decimal point, e.g. 1.2 or -29.8. - Example: - \qml - Item { width: 100.45; height: 150.82 } - \endqml + Example: + \qml + Item { width: 100.45; height: 150.82 } + \endqml - \note In QML all reals are stored in single precision, \l - {http://en.wikipedia.org/wiki/IEEE_754} {IEEE floating point} - format. + \note In QML all reals are stored in single precision, \l + {http://en.wikipedia.org/wiki/IEEE_754} {IEEE floating point} + format. - \sa {QML Basic Types} + \sa {QML Basic Types} */ /*! - \qmlbasictype string - \ingroup qmlbasictypes + \qmlbasictype string + \ingroup qmlbasictypes - \brief A string is a free form text in quotes, e.g. "Hello world!". + \brief A string is a free form text in quotes, e.g. "Hello world!". - A string is a free form text in quotes, e.g. "Hello world!". + A string is a free form text in quotes, e.g. "Hello world!". - Example: - \qml - Text { text: "Hello world!" } - \endqml + Example: + \qml + Text { text: "Hello world!" } + \endqml - \sa {QML Basic Types} + \sa {QML Basic Types} */ /*! - \qmlbasictype url - \ingroup qmlbasictypes + \qmlbasictype url + \ingroup qmlbasictypes - \brief A URL is a resource locator, like a file name. + \brief A URL is a resource locator, like a file name. - A URL is a resource locator, like a file name. It can be either - absolute, e.g. "http://qt.nokia.com", or relative, e.g. - "pics/logo.png". A relative URL is resolved relative to the URL of - the component where the URL is converted from a JavaScript string - expression to a url property value. + A URL is a resource locator, like a file name. It can be either + absolute, e.g. "http://qt.nokia.com", or relative, e.g. + "pics/logo.png". A relative URL is resolved relative to the URL of + the component where the URL is converted from a JavaScript string + expression to a url property value. - Example: - \qml - Image { source: "pics/logo.png" } - \endqml + Example: + \qml + Image { source: "pics/logo.png" } + \endqml - \raw HTML - \endraw + \raw HTML + \endraw - \sa {QML Basic Types} + \sa {QML Basic Types} */ /*! - \qmlbasictype color - \ingroup qmlbasictypes + \qmlbasictype color + \ingroup qmlbasictypes - \brief A color is a standard color name in quotes. + \brief A color is a standard color name in quotes. - A color is a standard color name in quotes. It is normally specified - as an \l {http://www.w3.org/TR/SVG/types.html#ColorKeywords} {SVG - color name}. These names include colors like "red", "green" and - "lightsteelblue". + A color is a standard color name in quotes. It is normally specified + as an \l {http://www.w3.org/TR/SVG/types.html#ColorKeywords} {SVG + color name}. These names include colors like "red", "green" and + "lightsteelblue". - If the color you want isn't part of this list, colors can also be - specified in hexidecimal triplets or quads that take 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". + If the color you want isn't part of this list, colors can also be + specified in hexidecimal triplets or quads that take 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". - Example: - \qml - Rectangle { color: "steelblue" } - Rectangle { color: "#FF0000" } - Rectangle { color: "#800000FF" } - \endqml + Example: + \qml + Rectangle { color: "steelblue" } + Rectangle { color: "#FF0000" } + Rectangle { color: "#800000FF" } + \endqml - Or with the \l{Qt::rgba()}{Qt.rgba()}, \l{Qt::hsla()}{Qt.hsla()}, \l{Qt::darker()}{Qt.darker()}, - \l{Qt::lighter()}{Qt.lighter()} or \l{Qt::tint()}{Qt.tint()} functions: + Or with the \l{Qt::rgba()}{Qt.rgba()}, \l{Qt::hsla()}{Qt.hsla()}, \l{Qt::darker()}{Qt.darker()}, + \l{Qt::lighter()}{Qt.lighter()} or \l{Qt::tint()}{Qt.tint()} functions: - \qml - Rectangle { color: Qt.rgba(255, 0, 0, 1) } - \endqml + \qml + Rectangle { color: Qt.rgba(255, 0, 0, 1) } + \endqml - \sa {QML Basic Types} + \sa {QML Basic Types} */ /*! - \qmlbasictype point - \ingroup qmlbasictypes + \qmlbasictype point + \ingroup qmlbasictypes - \brief A point is specified as "x,y". + \brief A point type has x and y attributes. - A point is specified as "x,y". + A \c point type has \c x and \c y attributes. - Example: - \qml - MyItem { position: "0,20" } - \endqml + To create a \c point value, specify it as a "x,y" string: - Or with the \l{Qt::point()}{Qt.point()} function: + \qml + CustomObject { myPointProperty: "0,20" } + \endqml - \qml - MyItem { position: Qt.point(0, 20) } - \endqml + Or use the \l{Qt::point()}{Qt.point()} function: - A point object has \c x and \c y attributes that contain the \c x and \c y values. + \qml + CustomObject { myPointProperty: Qt.point(0, 20) } + \endqml - \sa {QML Basic Types} + \sa {QML Basic Types} */ /*! - \qmlbasictype size - \ingroup qmlbasictypes + \qmlbasictype size + \ingroup qmlbasictypes + + \brief A size type has width and height attributes - \brief A size is specified as "width x height". + A \c size type has \c width and \c height attributes. - A size is specified as "width x height". + For example, to read the \l {Image::sourceSize} \c size property: - Example: - \qml - LayoutItem { preferredSize: "150x50" } - \endqml + \qml + Column { + Image { id: image; source: "logo.png" } + Text { text: image.sourceSize.width + "," + image.sourceSize.height } + } + \endqml - Or with the \l{Qt::size()}{Qt.size()} function: + To create a \c size value, specify it as a "width x height" string: - \qml - MyItem { position: Qt.size(150, 50) } - \endqml + \qml + LayoutItem { preferredSize: "150x50" } + \endqml - A size object has \c width and \c height attributes that contain the \c width and \c height values. + Or use the \l{Qt::size()}{Qt.size()} function: - \sa {QML Basic Types} + \qml + LayoutItem { preferredSize: Qt.size(150, 50) } + \endqml + + \sa {QML Basic Types} */ /*! - \qmlbasictype rect - \ingroup qmlbasictypes + \qmlbasictype rect + \ingroup qmlbasictypes + + \brief A rect type has x, y, width and height attributes. + + A \c rect type has \c x, \c y, \c width and \c height attributes. - \brief A rect is specified as "x, y, width x height". + For example, to read the \l {Item::childrenRect.x}{Item::childrenRect} \c rect property: + \qml + Rectangle { + width: childrenRect.width + height: childrenRect.height - A rect is specified as "x, y, width x height". + Rectangle { width: 100; height: 100 } + } + \endqml - Example: - \qml - MyItem { geometry: "50,50,100x100" } - \endqml + To create a \c rect value, specify it as a "x, y, width x height" string: - Or with the \l{Qt::rect()}{Qt.rect()} function: + \qml + CustomObject { myRectProperty: "50,50,100x100" } + \endqml - \qml - MyItem { position: Qt.rect(50, 50, 100, 100) } - \endqml + Or use the \l{Qt::rect()}{Qt.rect()} function: - A rect object has \c x, \c, y, \c width and \c height attributes that contain the - \c x, \c y, \c width and \c height values. + \qml + CustomObject { myRectProperty: Qt.rect(50, 50, 100, 100) } + \endqml - \sa {QML Basic Types} + \sa {QML Basic Types} */ /*! - \qmlbasictype date - \ingroup qmlbasictypes + \qmlbasictype date + \ingroup qmlbasictypes - \brief A date is specified as "YYYY-MM-DD". + \brief A date is specified as "YYYY-MM-DD". - A date is specified as "YYYY-MM-DD". + To create a \c date value, specify it as a "YYYY-MM-DD" string: - Example: - \qml - MyDatePicker { minDate: "2000-01-01"; maxDate: "2020-12-31" } - \endqml + Example: + \qml + MyDatePicker { minDate: "2000-01-01"; maxDate: "2020-12-31" } + \endqml - To read a date value returned from a C++ extension class, use - \l{Qt::formatDate()}{Qt.formatDate()} and \l{Qt::formatDateTime()}{Qt.formatDateTime()}. + To read a date value returned from a C++ extension class, use + \l{Qt::formatDate()}{Qt.formatDate()} and \l{Qt::formatDateTime()}{Qt.formatDateTime()}. - \sa {QML Basic Types} + \sa {QML Basic Types} */ /*! - \qmlbasictype time - \ingroup qmlbasictypes + \qmlbasictype time + \ingroup qmlbasictypes - \brief A time is specified as "hh:mm:ss". + \brief A time is specified as "hh:mm:ss". - A time is specified as "hh:mm:ss". + A time is specified as "hh:mm:ss". - Example: - \qml - MyTimePicker { time: "14:22:15" } - \endqml + Example: + \qml + MyTimePicker { time: "14:22:15" } + \endqml - To read a time value returned from a C++ extension class, use - \l{Qt::formatTime()}{Qt.formatTime()} and \l{Qt::formatDateTime()}{Qt.formatDateTime()}. + To read a time value returned from a C++ extension class, use + \l{Qt::formatTime()}{Qt.formatTime()} and \l{Qt::formatDateTime()}{Qt.formatDateTime()}. - \sa {QML Basic Types} + \sa {QML Basic Types} */ /*! - \qmlbasictype font - \ingroup qmlbasictypes + \qmlbasictype font + \ingroup qmlbasictypes - \brief A font type has the properties of a QFont. + \brief A font type has the properties of a QFont. - A font type has the properties of a QFont. The properties are: + A font type has the properties of a QFont. The properties are: - \list - \o \c string font.family - \o \c bool font.bold - \o \c bool font.italic - \o \c bool font.underline - \o \c real font.pointSize - \o \c int font.pixelSize - \endlist + \list + \o \c string font.family + \o \c bool font.bold + \o \c bool font.italic + \o \c bool font.underline + \o \c real font.pointSize + \o \c int font.pixelSize + \endlist - Example: - \qml - Text { font.family: "Helvetica"; font.pointSize: 13; font.bold: true } - \endqml + Example: + \qml + Text { font.family: "Helvetica"; font.pointSize: 13; font.bold: true } + \endqml - \sa {QML Basic Types} + \sa {QML Basic Types} */ /*! - \qmlbasictype action - \ingroup qmlbasictypes + \qmlbasictype action + \ingroup qmlbasictypes - \brief The action type has all the properties of QAction. + \brief The action type has all the properties of QAction. - The action type has all the properties of QAction. The properties - are: + The action type has all the properties of QAction. The properties + are: - \list - \o \c slot action.trigger - invoke the action - \o \c bool action.enabled - true if the action is enabled - \o \c string action.text - the text associated with the action - \endlist + \list + \o \c slot action.trigger - invoke the action + \o \c bool action.enabled - true if the action is enabled + \o \c string action.text - the text associated with the action + \endlist - Actions are used like this: + Actions are used like this: - \qml - MouseArea { onClicked: myaction.trigger() } - State { name: "enabled"; when: myaction.enabled == true } - Text { text: someaction.text } - \endqml + \qml + MouseArea { onClicked: myaction.trigger() } + State { name: "enabled"; when: myaction.enabled == true } + Text { text: someaction.text } + \endqml - \sa {QML Basic Types} + \sa {QML Basic Types} */ /*! - \qmlbasictype list - \ingroup qmlbasictypes - - \brief A list of objects. - - A list of objects. While not technically a basic type, QML also - supports lists of object types. When used from QML, the engine - automatically appends each value to the list. - - For example, the \l Item class contains a list property named - children that can be used like this: - - \qml - Item { - children: [ - Item { id: child1 }, - Rectangle { id: child2 }, - Text { id: child3 } - ] - } - \endqml - \c child1, \c child2 and \c child3 will all be added to the children list - in the order in which they appear. - - \sa {QML Basic Types} + \qmlbasictype list + \ingroup qmlbasictypes + + \brief A list of objects. + + A list of objects. While not technically a basic type, QML also + supports lists of object types. When used from QML, the engine + automatically appends each value to the list. + + For example, the \l Item class contains a list property named + children that can be used like this: + + \qml + Item { + children: [ + Item { id: child1 }, + Rectangle { id: child2 }, + Text { id: child3 } + ] + } + \endqml + \c child1, \c child2 and \c child3 will all be added to the children list + in the order in which they appear. + + \sa {QML Basic Types} */ /*! - \qmlbasictype vector3d - \ingroup qmlbasictypes + \qmlbasictype vector3d + \ingroup qmlbasictypes - \brief A vector3d is specified as "x,y,z". + \brief A vector3d type has x, y, and z attributes. - A vector3d is specified as "x,y,z". + A \c vector3d type has \c x, \c y, and \c z attributes. - \qml - Rotation { angle: 60; axis: "0,1,0" } - \endqml + To create a \c vector3d value, specify it as a "x,y,z" string: - or with the \c{Qt.vector3d()} function: + \qml + Rotation { angle: 60; axis: "0,1,0" } + \endqml - \qml - Rotation { angle: 60; axis: Qt.vector3d(0, 1, 0) } - \endqml + or with the \l{Qt::vector3d()}{Qt.vector3d()} function: - or as separate \c x, \c y, and \c z components: + \qml + Rotation { angle: 60; axis: Qt.vector3d(0, 1, 0) } + \endqml - \qml - Rotation { angle: 60; axis.x: 0; axis.y: 1; axis.z: 0 } - \endqml + or as separate \c x, \c y, and \c z components: - A vector3d object has \c x, \c, y, and \c z attributes that contain the - \c x, \c y, \c z values. + \qml + Rotation { angle: 60; axis.x: 0; axis.y: 1; axis.z: 0 } + \endqml - \sa {QML Basic Types} + \sa {QML Basic Types} */ diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc index 574a187..aa48bcb 100644 --- a/doc/src/declarative/elements.qdoc +++ b/doc/src/declarative/elements.qdoc @@ -59,8 +59,8 @@ The following table lists the QML elements provided by the \l {QtDeclarative}{Qt \o \l State \o \l PropertyChanges \o \l StateGroup +\o \l StateChangeScript \o \l ParentChange (Item-specific) -\o \l StateChangeScript (Item-specific) \o \l AnchorChanges (Item-specific) \endlist @@ -76,6 +76,7 @@ The following table lists the QML elements provided by the \l {QtDeclarative}{Qt \o \l ParentAnimation \o \l AnchorAnimation \o \l SmoothedAnimation +\o \l Vector3dAnimation \o \l PropertyAction \o \l ScriptAction \o \l Transition @@ -167,8 +168,8 @@ The following table lists the QML elements provided by the \l {QtDeclarative}{Qt \header \o \bold {Views} \o \bold {Positioners} -\o \bold {Media} \o \bold {Effects} +\o \row \o @@ -201,13 +202,6 @@ The following table lists the QML elements provided by the \l {QtDeclarative}{Qt \o \list -\o \l SoundEffect -\o \l Audio -\o \l Video -\endlist - -\o -\list \o \l Particles (experimental) \list \o \l ParticleMotionLinear @@ -217,4 +211,6 @@ The following table lists the QML elements provided by the \l {QtDeclarative}{Qt \endlist \endtable +\o + */ diff --git a/doc/src/declarative/pics/gridview-highlight.png b/doc/src/declarative/pics/gridview-highlight.png Binary files differnew file mode 100644 index 0000000..b54af37 --- /dev/null +++ b/doc/src/declarative/pics/gridview-highlight.png diff --git a/doc/src/declarative/pics/gridview-simple.png b/doc/src/declarative/pics/gridview-simple.png Binary files differnew file mode 100644 index 0000000..a102939 --- /dev/null +++ b/doc/src/declarative/pics/gridview-simple.png diff --git a/doc/src/declarative/pics/gridview.png b/doc/src/declarative/pics/gridview.png Binary files differdeleted file mode 100644 index 3726893..0000000 --- a/doc/src/declarative/pics/gridview.png +++ /dev/null diff --git a/doc/src/declarative/pics/translate.png b/doc/src/declarative/pics/translate.png Binary files differnew file mode 100644 index 0000000..baf58b0 --- /dev/null +++ b/doc/src/declarative/pics/translate.png diff --git a/doc/src/declarative/pics/visualitemmodel.png b/doc/src/declarative/pics/visualitemmodel.png Binary files differnew file mode 100644 index 0000000..5e6d132 --- /dev/null +++ b/doc/src/declarative/pics/visualitemmodel.png diff --git a/doc/src/snippets/declarative/drag.qml b/doc/src/snippets/declarative/drag.qml deleted file mode 100644 index 0a69574..0000000 --- a/doc/src/snippets/declarative/drag.qml +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import Qt 4.7 - -//! [0] -Rectangle { - id: blurtest; width: 600; height: 200; color: "white" - Image { - id: pic; source: "qtlogo-64.png"; anchors.verticalCenter: parent.verticalCenter - opacity: (600.0-pic.x) / 600; - MouseArea { - anchors.fill: parent - drag.target: pic - drag.axis: Drag.XAxis - drag.minimumX: 0 - drag.maximumX: blurtest.width-pic.width - } - } -} -//! [0] diff --git a/doc/src/snippets/declarative/gridview/dummydata/ContactModel.qml b/doc/src/snippets/declarative/gridview/ContactModel.qml index 1e79030..2da4660 100644 --- a/doc/src/snippets/declarative/gridview/dummydata/ContactModel.qml +++ b/doc/src/snippets/declarative/gridview/ContactModel.qml @@ -39,28 +39,26 @@ ** ****************************************************************************/ +//![0] import Qt 4.7 ListModel { - id: contactModel + ListElement { - name: "Bill Smith" - number: "555 3264" + name: "Jim Williams" portrait: "pics/portrait.png" } ListElement { - name: "Jim Williams" - number: "555 5673" + name: "John Brown" portrait: "pics/portrait.png" } ListElement { - name: "John Brown" - number: "555 8426" + name: "Bill Smyth" portrait: "pics/portrait.png" } ListElement { name: "Sam Wise" - number: "555 0473" portrait: "pics/portrait.png" } } +//![0] diff --git a/doc/src/snippets/declarative/gridview/gridview.qml b/doc/src/snippets/declarative/gridview/gridview.qml index 3c205bc..0b3bbf3 100644 --- a/doc/src/snippets/declarative/gridview/gridview.qml +++ b/doc/src/snippets/declarative/gridview/gridview.qml @@ -39,50 +39,98 @@ ** ****************************************************************************/ +//![import] import Qt 4.7 +//![import] -//! [3] Rectangle { - width: 240; height: 180; color: "white" - // ContactModel model is defined in dummydata/ContactModel.qml - // The viewer automatically loads files in dummydata/* to assist - // development without a real data source. - - // Define a delegate component. A component will be - // instantiated for each visible item in the list. -//! [0] + width: childrenRect.width; height: childrenRect.height + +Row { + +//![classdocs simple] +GridView { + width: 300; height: 200 + + model: ContactModel {} + delegate: Column { + Image { source: portrait; anchors.horizontalCenter: parent.horizontalCenter } + Text { text: name; anchors.horizontalCenter: parent.horizontalCenter } + } +} +//![classdocs simple] + + +//![classdocs advanced] +Rectangle { + width: 300; height: 200 + Component { - id: delegate + id: contactDelegate Item { - id: wrapper - width: 80; height: 78 + width: grid.cellWidth; height: grid.cellHeight Column { + anchors.fill: parent Image { source: portrait; anchors.horizontalCenter: parent.horizontalCenter } Text { text: name; anchors.horizontalCenter: parent.horizontalCenter } } } } -//! [0] - // Define a highlight component. Just one of these will be instantiated - // by each ListView and placed behind the current item. -//! [1] - Component { - id: highlight - Rectangle { - color: "lightsteelblue" - radius: 5 - } - } -//! [1] - // The actual grid -//! [2] + GridView { - width: parent.width; height: parent.height - model: ContactModel; delegate: delegate + id: grid + anchors.fill: parent cellWidth: 80; cellHeight: 80 - highlight: highlight + + model: ContactModel {} + delegate: contactDelegate + highlight: Rectangle { color: "lightsteelblue"; radius: 5 } focus: true } -//! [2] } -//! [3] +//![classdocs advanced] + +//![delayRemove] +Component { + id: delegate + Item { + GridView.onRemove: SequentialAnimation { + PropertyAction { target: wrapper; property: "GridView.delayRemove"; value: true } + NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing.type: Easing.InOutQuad } + PropertyAction { target: wrapper; property: "GridView.delayRemove"; value: false } + } + } +} +//![delayRemove] + +//![highlightFollowsCurrentItem] +Component { + id: highlight + Rectangle { + width: view.cellWidth; height: view.cellHeight + color: "lightsteelblue"; radius: 5 + SpringFollow on x { to: view.currentItem.x; spring: 3; damping: 0.2 } + SpringFollow on y { to: view.currentItem.y; spring: 3; damping: 0.2 } + } +} + +GridView { + id: view + width: 300; height: 200 + cellWidth: 80; cellHeight: 80 + + model: ContactModel {} + delegate: Column { + Image { source: portrait; anchors.horizontalCenter: parent.horizontalCenter } + Text { text: name; anchors.horizontalCenter: parent.horizontalCenter } + } + + highlight: highlight + highlightFollowsCurrentItem: false + focus: true +} +//![highlightFollowsCurrentItem] + +} + +} diff --git a/doc/src/snippets/declarative/listview/highlight.qml b/doc/src/snippets/declarative/listview/highlight.qml deleted file mode 100644 index af9e95f..0000000 --- a/doc/src/snippets/declarative/listview/highlight.qml +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import Qt 4.7 - -Rectangle { - width: 180; height: 200; color: "white" - - // ContactModel model is defined in dummydata/ContactModel.qml - // The viewer automatically loads files in dummydata/* to assist - // development without a real data source. - - // Define a delegate component. A component will be - // instantiated for each visible item in the list. -//! [0] - Component { - id: delegate - Item { - id: wrapper - width: 180; height: 40 - Column { - x: 5; y: 5 - Text { text: '<b>Name:</b> ' + name } - Text { text: '<b>Number:</b> ' + number } - } - // Use the ListView.isCurrentItem attached property to - // indent the item if it is the current item. - states: [ - State { - name: "Current" - when: wrapper.ListView.isCurrentItem - PropertyChanges { target: wrapper; x: 10 } - } - ] - transitions: [ - Transition { NumberAnimation { properties: "x"; duration: 200 } } - ] - } - } -//! [0] - // Specify a highlight with custom movement. Note that autoHighlight - // is set to false in the ListView so that we can control how the - // highlight moves to the current item. -//! [1] - Component { - id: highlight - Rectangle { - width: 180; height: 40 - color: "lightsteelblue"; radius: 5 - SpringFollow on y { - to: list.currentItem.y - spring: 3 - damping: 0.2 - } - } - } - ListView { - id: list - width: parent.height; height: parent.height - model: ContactModel; delegate: delegate - highlight: highlight - highlightFollowsCurrentItem: false - focus: true - } -//! [1] -} diff --git a/doc/src/snippets/declarative/mouseregion.qml b/doc/src/snippets/declarative/mousearea.qml index a162854..c6071c7 100644 --- a/doc/src/snippets/declarative/mouseregion.qml +++ b/doc/src/snippets/declarative/mousearea.qml @@ -39,11 +39,17 @@ ** ****************************************************************************/ +//! [import] import Qt 4.7 +//! [import] + +Rectangle { + width: childrenRect.width + height: childrenRect.height -Rectangle { width: 200; height: 100 Row { -//! [0] + +//! [intro] Rectangle { width: 100; height: 100 color: "green" @@ -53,8 +59,9 @@ Rectangle { onClicked: { parent.color = 'red' } } } -//! [0] -//! [1] +//! [intro] + +//! [intro-extended] Rectangle { width: 100; height: 100 color: "green" @@ -70,6 +77,43 @@ Rectangle { } } } -//! [1] +//! [intro-extended] + +//! [drag] +Rectangle { + id: container + width: 600; height: 200 + + Image { + id: pic + source: "pics/qt.png" + opacity: (600.0 - pic.x) / 600 + + MouseArea { + anchors.fill: parent + drag.target: pic + drag.axis: Drag.XAxis + drag.minimumX: 0 + drag.maximumX: container.width - pic.width + } + } +} +//! [drag] + +//! [mousebuttons] +Text { + text: mouseArea.pressedButtons & Qt.RightButton ? "right" : "" + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + + MouseArea { + id: mouseArea + anchors.fill: parent + acceptedButtons: Qt.LeftButton | Qt.RightButton + } +} +//! [mousebuttons] + } + } diff --git a/doc/src/snippets/declarative/pathview/dummydata/MenuModel.qml b/doc/src/snippets/declarative/pathview/ContactModel.qml index a52b60a..1a042a3 100644 --- a/doc/src/snippets/declarative/pathview/dummydata/MenuModel.qml +++ b/doc/src/snippets/declarative/pathview/ContactModel.qml @@ -39,20 +39,21 @@ ** ****************************************************************************/ +//![0] import Qt 4.7 ListModel { - id: menuModel ListElement { name: "Bill Jones" - icon: "pics/qtlogo-64.png" + icon: "pics/qtlogo.png" } ListElement { name: "Jane Doe" - icon: "pics/qtlogo-64.png" + icon: "pics/qtlogo.png" } ListElement { name: "John Smith" - icon: "pics/qtlogo-64.png" + icon: "pics/qtlogo.png" } } +//![0] diff --git a/doc/src/snippets/declarative/pathview/pathattributes.qml b/doc/src/snippets/declarative/pathview/pathattributes.qml index e8d2509..3ba3b95 100644 --- a/doc/src/snippets/declarative/pathview/pathattributes.qml +++ b/doc/src/snippets/declarative/pathview/pathattributes.qml @@ -39,16 +39,16 @@ ** ****************************************************************************/ +//! [0] import Qt 4.7 Rectangle { - width: 240; height: 200; color: 'white' -//! [0] + width: 240; height: 200 + //! [1] Component { id: delegate Item { - id: wrapper width: 80; height: 80 scale: PathView.scale opacity: PathView.opacity @@ -59,9 +59,12 @@ Rectangle { } } //! [1] + //! [2] PathView { - anchors.fill: parent; model: MenuModel; delegate: delegate + anchors.fill: parent + model: ContactModel {} + delegate: delegate path: Path { startX: 120; startY: 100 PathAttribute { name: "scale"; value: 1.0 } @@ -73,5 +76,5 @@ Rectangle { } } //! [2] -//! [0] } +//! [0] diff --git a/doc/src/snippets/declarative/pathview/pathview.qml b/doc/src/snippets/declarative/pathview/pathview.qml index 31b793d..1669847 100644 --- a/doc/src/snippets/declarative/pathview/pathview.qml +++ b/doc/src/snippets/declarative/pathview/pathview.qml @@ -39,27 +39,27 @@ ** ****************************************************************************/ +//! [0] import Qt 4.7 Rectangle { - width: 240; height: 200; color: 'white' -//! [0] + width: 240; height: 200 + //! [1] Component { id: delegate - Item { - id: wrapper - width: 80; height: 80 - Column { - Image { anchors.horizontalCenter: name.horizontalCenter; width: 64; height: 64; source: icon } - Text { text: name; font.pointSize: 16} - } + Column { + Image { anchors.horizontalCenter: name.horizontalCenter; width: 64; height: 64; source: icon } + Text { text: name; font.pointSize: 16 } } } //! [1] + //! [2] PathView { - anchors.fill: parent; model: MenuModel; delegate: delegate + anchors.fill: parent + model: ContactModel {} + delegate: delegate path: Path { startX: 120; startY: 100 PathQuad { x: 120; y: 25; controlX: 260; controlY: 75 } @@ -67,5 +67,5 @@ Rectangle { } } //! [2] -//! [0] } +//! [0] diff --git a/doc/src/snippets/declarative/pathview/pics/qtlogo-64.png b/doc/src/snippets/declarative/pathview/pics/qtlogo.png Binary files differindex 4f68e16..4f68e16 100644 --- a/doc/src/snippets/declarative/pathview/pics/qtlogo-64.png +++ b/doc/src/snippets/declarative/pathview/pics/qtlogo.png |