summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/code
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-07-02 17:32:53 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-07-02 17:32:53 (GMT)
commit174e40c348eb45417f44bcf4077ca751204d6f9e (patch)
treea08fac85835b6e3703715ac4485e85ea62cbace4 /doc/src/snippets/code
parentb4d96f534ed84c3bc070b7b40f61b897f2fcfe78 (diff)
parent68ad4618e02d1686e37b979fbf1fd1f349aa6d4f (diff)
downloadQt-174e40c348eb45417f44bcf4077ca751204d6f9e.zip
Qt-174e40c348eb45417f44bcf4077ca751204d6f9e.tar.gz
Qt-174e40c348eb45417f44bcf4077ca751204d6f9e.tar.bz2
Merge branch 'master' of git://scm.dev.nokia.troll.no/qt/qt-air-team
* 'master' of git://scm.dev.nokia.troll.no/qt/qt-air-team: (31 commits) changelog Compile with DEBUG_FONTENGINE define minor optimization remove the old compatibility code make QFontEngineQPF1 work even without mmap(2) support Re-apply licenseheader text in source files for qt4.7 Make sure the declarative plugin of QtWebKit is build once. Doc: Fixing typo Update 4.8.0 changes file Symbian socket engine: remove remaining todo comments Symbian: tune network autotest heap size so they can run on emulator Cocoa: QFileDialog: fix filename filter not applied correctly Fix typo in docs: occurred. Cocoa: fix qtabwidget auto test failure Cocoa: fix qwidget auto test failures Fix QWidget::palettePropagation2() autotest on Symbian (part 2) Cocoa: Fix qgraphicsproxywidget auto test Fix QWidget::palettePropagation2() autotest on Symbian QTBUG-19500 lupdate fails to run from the Mac binary package on Mac OS X 10.5 Fix text color in some cases of QML and QStaticText ...
Diffstat (limited to 'doc/src/snippets/code')
-rw-r--r--doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp35
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]
+