diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-04-04 13:58:25 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-04-04 13:58:25 (GMT) |
commit | 676a3e39ed4732bcc5b1639f4527393ddd31b418 (patch) | |
tree | 7e366179ef6bddf3fa4687e0d33f3a89c871f09f /doc/src/snippets/code/doc_src_model-view-programming.cpp | |
parent | 581402951131c2b83f558916703eec06e454dd27 (diff) | |
parent | 07df7ee20a0f3027516ad03465a2fb7b7e38e864 (diff) | |
download | Qt-676a3e39ed4732bcc5b1639f4527393ddd31b418.zip Qt-676a3e39ed4732bcc5b1639f4527393ddd31b418.tar.gz Qt-676a3e39ed4732bcc5b1639f4527393ddd31b418.tar.bz2 |
Merge branch 'master' of git://scm.dev.nokia.troll.no/qt/qt-fire-team
* 'master' of git://scm.dev.nokia.troll.no/qt/qt-fire-team: (246 commits)
Avoid some compiler warnings on Windows
Fix positioning in GL2 paint engine with subpixel antialiasing
Update defs files
Doc: Updating 3rdparty license doc
Another compilation fix for WinCE
Remove obsolete patch file
Fix animation tests after merge
Remove duplicated test.
Add missing test file.
Changing width of RTL positioner doesn't relayout
Fix TextInput auto test failure on mac.
PinchArea and Flickable don't work well enough together
Do not set focus unnecessarily at window activation in Symbian
QS60Style: Regression in drawing dialog background
QS60Style: Support menu separator (pt.2)
Fix auto test failure.
Support for new softkey in Symbian^3
Once Image sourceSize is set there is no way to clear it.
Rotation transform with NaN angle can cause crash
QSoftkeyManager auto test update
...
Diffstat (limited to 'doc/src/snippets/code/doc_src_model-view-programming.cpp')
-rw-r--r-- | doc/src/snippets/code/doc_src_model-view-programming.cpp | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/doc/src/snippets/code/doc_src_model-view-programming.cpp b/doc/src/snippets/code/doc_src_model-view-programming.cpp new file mode 100644 index 0000000..05c2e1d --- /dev/null +++ b/doc/src/snippets/code/doc_src_model-view-programming.cpp @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [0] +QAbstractItemModel *model = index.model(); +//! [0] + + +//! [1] +QModelIndex index = model->index(row, column, ...); +//! [1] + + +//! [2] +QModelIndex indexA = model->index(0, 0, QModelIndex()); +QModelIndex indexB = model->index(1, 1, QModelIndex()); +QModelIndex indexC = model->index(2, 1, QModelIndex()); +//! [2] + + +//! [3] +QModelIndex index = model->index(row, column, parent); +//! [3] + + +//! [4] +QModelIndex indexA = model->index(0, 0, QModelIndex()); +QModelIndex indexC = model->index(2, 1, QModelIndex()); +//! [4] + + +//! [5] +QModelIndex indexB = model->index(1, 0, indexA); +//! [5] + + +//! [6] +QVariant value = model->data(index, role); +//! [6] |