summaryrefslogtreecommitdiffstats
path: root/doc/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-10-21 08:16:05 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-10-21 08:16:05 (GMT)
commitb8238ec7e41d483a9166eb7aebbf911f36976cdc (patch)
treeb3f8f08911714ccd653f1f2df4876cf2638b5090 /doc/src
parentd28057dc6f282c2cc129eae40a4fb1555fef455c (diff)
parent03c1445ed4be734a82cea59d107c51a4be43c5f4 (diff)
downloadQt-b8238ec7e41d483a9166eb7aebbf911f36976cdc.zip
Qt-b8238ec7e41d483a9166eb7aebbf911f36976cdc.tar.gz
Qt-b8238ec7e41d483a9166eb7aebbf911f36976cdc.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Fix compilation with QT_NO_KEYWORDS Replaced sample text for Japanese font Fix the #ifdef position. Deactivate the auto-test on problematic platforms. Enable the unified toolbar with the raster configure: Don't use character class when looking for QMAKE_CONF_COMPILER Moving the resetInternalData slot to QAbstractProxyModel Provide the resetInternalData slot to cleanly reset data in proxy subclasses. Emit beginResetModel before updating the strings. Send the hoverLeave not properly sent on the widget inside QGPW.
Diffstat (limited to 'doc/src')
-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 59e6ae0..07ff2a0 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]
+