diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-06-10 02:16:04 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-06-10 02:16:04 (GMT) |
commit | fa9c32829025121ab203565dd86a1c55028f40aa (patch) | |
tree | 2ca7441d9ed32c4c2eb228e1d30e8b377fa4ae1f /doc/src/snippets/declarative/listmodel-simple.qml | |
parent | 9fc91de560b1302ff6cf238b3d179fc778066fcf (diff) | |
parent | 28b14cbb2003671f6f76b15d069572ef42194e62 (diff) | |
download | Qt-fa9c32829025121ab203565dd86a1c55028f40aa.zip Qt-fa9c32829025121ab203565dd86a1c55028f40aa.tar.gz Qt-fa9c32829025121ab203565dd86a1c55028f40aa.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: (39 commits)
Remove 'XXX Experimental' from VisualItemModel/VisualDataModel and
Document attached properties
Add 'on' prefix to documentation of signals
Stablize qmlviewer test
Improve test stability.
qmlviewer: ensure that only clicks on the current file list are handled.
Doc improvements: move some example code to snippets, add screenshots,
Move some example code into snippets/ and add other doc fixes
Fix crash when changing ListView model with highlightRangeMode: ListView.StrictlyEnforceRange
Fix GridView bounds behavior with snapping enabled.
Small optimization when checking if MouseArea's onPressAndHold is
Fix autotest.
Fixed `nmake clean' breaking declarative imports on Windows.
Fix drawing flicker on Qml Viewer startup
Fix snake demo
Add qmlmethod Item::childAt() to delarative item
Cursor positioning in QTextDocument after undo()
Fix slow network access in qmlviewer (Windows)
Don't layout multiple times when an ancestor becomes (in)visible.
Add an example of animated item add/remove in ListView
...
Diffstat (limited to 'doc/src/snippets/declarative/listmodel-simple.qml')
-rw-r--r-- | doc/src/snippets/declarative/listmodel-simple.qml | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/doc/src/snippets/declarative/listmodel-simple.qml b/doc/src/snippets/declarative/listmodel-simple.qml new file mode 100644 index 0000000..00b8cb0 --- /dev/null +++ b/doc/src/snippets/declarative/listmodel-simple.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ +//![0] +import Qt 4.7 + +Rectangle { + width: 200; height: 200 + + ListModel { + id: fruitModel +//![0] + ListElement { + name: "Apple" + cost: 2.45 + } + ListElement { + name: "Orange" + cost: 3.25 + } + ListElement { + name: "Banana" + cost: 1.95 + } +//![1] + } + + Component { + id: fruitDelegate + Row { + spacing: 10 + Text { text: name } + Text { text: '$' + cost } + } + } + + ListView { + anchors.fill: parent + model: fruitModel + delegate: fruitDelegate + } +} +//![1] |