diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/src/declarative/examples.qdoc | 1 | ||||
-rw-r--r-- | doc/src/declarative/focus.qdoc | 7 | ||||
-rw-r--r-- | doc/src/declarative/pics/listview-highlight.png (renamed from doc/src/declarative/pics/trivialListView.png) | bin | 5918 -> 5918 bytes | |||
-rw-r--r-- | doc/src/declarative/pics/listview-simple.png | bin | 0 -> 5351 bytes | |||
-rw-r--r-- | doc/src/examples/qml-examples.qdoc | 7 | ||||
-rw-r--r-- | doc/src/snippets/declarative/listview/ContactModel.qml (renamed from doc/src/snippets/declarative/listview/dummydata/ContactModel.qml) | 3 | ||||
-rw-r--r-- | doc/src/snippets/declarative/listview/listview.qml | 116 |
7 files changed, 92 insertions, 42 deletions
diff --git a/doc/src/declarative/examples.qdoc b/doc/src/declarative/examples.qdoc index 5d3b8e4..5b8c937 100644 --- a/doc/src/declarative/examples.qdoc +++ b/doc/src/declarative/examples.qdoc @@ -82,7 +82,6 @@ For example, from your build directory, run: \section2 Image Elements \list \o \l{declarative/imageelements/borderimage}{BorderImage} -\o \l{declarative/imageelements/image}{Image} \endlist \section2 \l{declarative/positioners}{Positioners} diff --git a/doc/src/declarative/focus.qdoc b/doc/src/declarative/focus.qdoc index e2b8bb6..4c4a317 100644 --- a/doc/src/declarative/focus.qdoc +++ b/doc/src/declarative/focus.qdoc @@ -67,7 +67,12 @@ item and thus subsequently be \l {QEvent::ignore()}{ignored}. \code Item { Item { - Keys.onPressed: if (event.key == Qt.Key_A) { console.log('Key A was pressed'); event.accepted = true } + Keys.onPressed: { + if (event.key == Qt.Key_A) { + console.log('Key A was pressed'); + event.accepted = true; + } + } Rectangle {} } } diff --git a/doc/src/declarative/pics/trivialListView.png b/doc/src/declarative/pics/listview-highlight.png Binary files differindex dc5c6b3..dc5c6b3 100644 --- a/doc/src/declarative/pics/trivialListView.png +++ b/doc/src/declarative/pics/listview-highlight.png diff --git a/doc/src/declarative/pics/listview-simple.png b/doc/src/declarative/pics/listview-simple.png Binary files differnew file mode 100644 index 0000000..71a1c51 --- /dev/null +++ b/doc/src/declarative/pics/listview-simple.png diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc index 2973d8c..7a0fcca 100644 --- a/doc/src/examples/qml-examples.qdoc +++ b/doc/src/examples/qml-examples.qdoc @@ -71,13 +71,6 @@ */ /*! - \title Image - \example declarative/imageelements/image - - This example shows uses of the \l Image element in QML. -*/ - -/*! \title Reference examples \example declarative/cppextensions/referenceexamples */ diff --git a/doc/src/snippets/declarative/listview/dummydata/ContactModel.qml b/doc/src/snippets/declarative/listview/ContactModel.qml index 20687cf..b930c06 100644 --- a/doc/src/snippets/declarative/listview/dummydata/ContactModel.qml +++ b/doc/src/snippets/declarative/listview/ContactModel.qml @@ -1,7 +1,7 @@ +//![0] import Qt 4.7 ListModel { - id: contactModel ListElement { name: "Bill Smith" number: "555 3264" @@ -15,3 +15,4 @@ ListModel { number: "555 0473" } } +//![0] diff --git a/doc/src/snippets/declarative/listview/listview.qml b/doc/src/snippets/declarative/listview/listview.qml index 61bf126..1e9ccd9 100644 --- a/doc/src/snippets/declarative/listview/listview.qml +++ b/doc/src/snippets/declarative/listview/listview.qml @@ -1,49 +1,101 @@ +//![import] import Qt 4.7 +//![import] -//! [3] -Rectangle { - width: 180; height: 200; color: "white" +Item { + +//![classdocs simple] +ListView { + width: 180; height: 200 + + model: ContactModel {} + delegate: Text { + text: name + ": " + number + } +} +//![classdocs simple] - // ContactModel model is defined in dummydata/ContactModel.qml - // The viewer automatically loads files in dummydata/* to assist - // development without a real data source. +//![classdocs advanced] +Rectangle { + width: 180; height: 200 - // Define a delegate component. A component will be - // instantiated for each visible item in the list. -//! [0] Component { - id: delegate + id: contactDelegate Item { - id: wrapper width: 180; height: 40 Column { - x: 5; y: 5 Text { text: '<b>Name:</b> ' + name } Text { text: '<b>Number:</b> ' + number } } } } -//! [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 list -//! [2] + ListView { - width: parent.width; height: parent.height - model: ContactModel - delegate: delegate - highlight: highlight + anchors.fill: parent + model: ContactModel {} + delegate: contactDelegate + highlight: Rectangle { color: "lightsteelblue"; radius: 5 } focus: true } -//! [2] } -//! [3] +//![classdocs advanced] + +//![delayRemove] +Component { + id: delegate + Item { + ListView.onRemove: SequentialAnimation { + PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: true } + NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing.type: Easing.InOutQuad } + PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: false } + } + } +} +//![delayRemove] + +//![highlightFollowsCurrentItem] +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: 180; height: 200 + model: ContactModel {} + delegate: Text { text: name } + + highlight: highlight + highlightFollowsCurrentItem: false + focus: true +} +//![highlightFollowsCurrentItem] + +//![isCurrentItem] +ListView { + width: 180; height: 200 + + Component { + id: contactsDelegate + Text { + id: contactInfo + text: name + ": " + number + color: contactInfo.ListView.isCurrentItem ? "red" : "black" + } + } + + model: ContactModel {} + delegate: contactsDelegate + focus: true +} +//![isCurrentItem] + +} |