summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/declarative/gridview/gridview.qml
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-06-03 03:19:36 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-06-03 03:19:36 (GMT)
commitbb30e507c69ef9b91af73638ffb5771ce4f808e0 (patch)
tree3e154c2ad790dd6d157bfa8c4d4f7f8d484c3342 /doc/src/snippets/declarative/gridview/gridview.qml
parent0fd09af3a05ac88c55fed73c85dc1c5aba68f057 (diff)
parent867730e3dfa553d7bc230cdcbd655347f5103278 (diff)
downloadQt-bb30e507c69ef9b91af73638ffb5771ce4f808e0.zip
Qt-bb30e507c69ef9b91af73638ffb5771ce4f808e0.tar.gz
Qt-bb30e507c69ef9b91af73638ffb5771ce4f808e0.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: Add Q_AUTOTEST_EXPORT Ensure PathView mappedRange is updated when pathItemCount changes. Doc Fix basic types docs indentation Improve basic types documentation. Don't imply that Item has Remove Media elements from Elements index Add some Q_AUTOTEST_EXPORTs Keep ListView highlight in sync when currentItem changes geometry. QDeclarativeImage::updatePaintedGeometry() does not need to be a slot QML viewer now supports TopUp, TopDown, RightUp and LeftUp orientations Text should update when the alignment changes. Add qml import plugins to qt.iby and qt.sis Take into account platform differences in input panel support More autoScroll fixes Doc fixes and improvements - fix some example code, link to Add Vector3dAnimation to list of QML elements
Diffstat (limited to 'doc/src/snippets/declarative/gridview/gridview.qml')
-rw-r--r--doc/src/snippets/declarative/gridview/gridview.qml110
1 files changed, 79 insertions, 31 deletions
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]
+
+}
+
+}