From e866577453334f528fdf289ab825af1911586e47 Mon Sep 17 00:00:00 2001 From: Kavindra Devi Palaraja Date: Fri, 21 Aug 2009 14:31:32 +0200 Subject: Doc - Clarified the use of layoutChanged() in relation to persistent model indexes Reviewed-By: Olivier Goffart Task: 231608 --- src/corelib/kernel/qabstractitemmodel.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp index 17af60d..3b7059b 100644 --- a/src/corelib/kernel/qabstractitemmodel.cpp +++ b/src/corelib/kernel/qabstractitemmodel.cpp @@ -1216,7 +1216,16 @@ void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent, layoutChanged() after changing the layout. Subclasses should update any persistent model indexes before emitting - layoutChanged(). + layoutChanged(). In other words, when the structure changes: + + \list + \o Call beginLayoutChanged() + \o Remember the QModelIndex that will change + \o Update your internal data + \o Call changePersistentIndex() + \o Call endLayoutChanged() + \endlist + \sa layoutAboutToBeChanged(), dataChanged(), headerDataChanged(), reset(), changePersistentIndex() -- cgit v0.12