diff options
| author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-06-29 18:16:55 (GMT) |
|---|---|---|
| committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-06-29 18:16:55 (GMT) |
| commit | 7a2f721d74892c7eeff9aba370b6c081612c634b (patch) | |
| tree | a8c8d5d5e8ed4bb68710bc30edba6e8c34621823 /doc/src/snippets/code | |
| parent | fff467981fe515974e722e1d092a916f6a8f5dcc (diff) | |
| parent | 680023c4921019614948c277cde5498645836cb9 (diff) | |
| download | Qt-7a2f721d74892c7eeff9aba370b6c081612c634b.zip Qt-7a2f721d74892c7eeff9aba370b6c081612c634b.tar.gz Qt-7a2f721d74892c7eeff9aba370b6c081612c634b.tar.bz2 | |
Merge branch 'master' of git://scm.dev.nokia.troll.no/qt/qt-water-team
* 'master' of git://scm.dev.nokia.troll.no/qt/qt-water-team:
Fix typo in docs: occurred.
Cocoa: fix qtabwidget auto test failure
Cocoa: fix qwidget auto test failures
Cocoa: Fix qgraphicsproxywidget auto test
Use Q_SLOTS instead of slots in public headers.
Fix a11y crash: dock doesn't always have a widget.
Fix typo in comment.
Mac: respect WA_ShowWithoutActivating flag
Remove misleading and incorrect information from dropMimeData docs.
Provide the resetInternalData slot to cleanly reset data in proxy subclasses.
Mac: switch raster off as default paint engine
Diffstat (limited to 'doc/src/snippets/code')
| -rw-r--r-- | doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp b/doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp index 5919c01..cf40f9a 100644 --- a/doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp +++ b/doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp @@ -86,3 +86,38 @@ beginMoveRows(parent, 2, 2, parent, 0); //! [9] beginMoveRows(parent, 2, 2, parent, 4); //! [9] + + +//! [10] +class CustomDataProxy : public QSortFilterProxyModel +{ + Q_OBJECT +public: + CustomDataProxy(QObject *parent) + : QSortFilterProxyModel(parent) + { + } + + ... + + QVariant data(const QModelIndex &index, int role) + { + if (role != Qt::BackgroundRole) + return QSortFilterProxyModel::data(index, role); + + if (m_customData.contains(index.row())) + return m_customData.value(index.row()); + return QSortFilterProxyModel::data(index, role); + } + +private slots: + void resetInternalData() + { + m_customData.clear(); + } + +private: + QHash<int, QVariant> m_customData; +}; +//! [10] + |
