diff options
author | mread <qt-info@nokia.com> | 2009-08-28 11:34:31 (GMT) |
---|---|---|
committer | mread <qt-info@nokia.com> | 2009-08-28 11:34:31 (GMT) |
commit | b165e6a8f86efb8aebdca44c092907d2750533d4 (patch) | |
tree | 0b70cfc8602aab9320b0a60a63e8fedf6c67857c /src/corelib/kernel | |
parent | 719d5ac4220744d17344ff07ffaa9e86c01ac412 (diff) | |
parent | 7449a69e39b3ccd877da3e5ad7a9154ab7751dec (diff) | |
download | Qt-b165e6a8f86efb8aebdca44c092907d2750533d4.zip Qt-b165e6a8f86efb8aebdca44c092907d2750533d4.tar.gz Qt-b165e6a8f86efb8aebdca44c092907d2750533d4.tar.bz2 |
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into 4.6
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qabstractitemmodel.cpp | 48 | ||||
-rw-r--r-- | src/corelib/kernel/qabstractitemmodel.h | 3 | ||||
-rw-r--r-- | src/corelib/kernel/qcore_symbian_p.cpp | 4 | ||||
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 14 |
4 files changed, 52 insertions, 17 deletions
diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp index 1c9104a..5e8848b 100644 --- a/src/corelib/kernel/qabstractitemmodel.cpp +++ b/src/corelib/kernel/qabstractitemmodel.cpp @@ -1339,7 +1339,7 @@ void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent, \endlist - \sa layoutAboutToBeChanged(), dataChanged(), headerDataChanged(), reset(), + \sa layoutAboutToBeChanged(), dataChanged(), headerDataChanged(), modelReset(), changePersistentIndex() */ @@ -2769,7 +2769,24 @@ void QAbstractItemModel::endMoveColumns() /*! Resets the model to its original state in any attached views. - The view to which the model is attached to will be reset as well. + \note Use beginResetModel() and endResetModel() instead whenever possible. + Use this method only if there is no way to call beginResetModel() before invalidating the model. + Otherwise it could lead to unexcpected behaviour, especially when used with proxy models. +*/ +void QAbstractItemModel::reset() +{ + Q_D(QAbstractItemModel); + emit modelAboutToBeReset(); + d->invalidatePersistentIndexes(); + emit modelReset(); +} + +/*! + Begins a model reset operation. + + A reset operation resets the model to its current state in any attached views. + + \note Any views attached to this model will be reset as well. When a model is reset it means that any previous data reported from the model is now invalid and has to be queried for again. This also means that @@ -2779,12 +2796,29 @@ void QAbstractItemModel::endMoveColumns() call this function rather than emit dataChanged() to inform other components when the underlying data source, or its structure, has changed. - \sa modelAboutToBeReset(), modelReset() + You must call this function before resetting any internal data structures in your model + or proxy model. + + \sa modelAboutToBeReset(), modelReset(), endResetModel() + \since 4.6 */ -void QAbstractItemModel::reset() +void QAbstractItemModel::beginResetModel() { - Q_D(QAbstractItemModel); emit modelAboutToBeReset(); +} + +/*! + Completes a model reset operation. + + You must call this function after resetting any internal data structure in your model + or proxy model. + + \sa beginResetModel() + \since 4.6 +*/ +void QAbstractItemModel::endResetModel() +{ + Q_D(QAbstractItemModel); d->invalidatePersistentIndexes(); emit modelReset(); } @@ -3256,7 +3290,7 @@ bool QAbstractListModel::dropMimeData(const QMimeData *data, Qt::DropAction acti This signal is emitted when reset() is called, before the model's internal state (e.g. persistent model indexes) has been invalidated. - \sa reset(), modelReset() + \sa beginResetModel(), modelReset() */ /*! @@ -3266,7 +3300,7 @@ bool QAbstractListModel::dropMimeData(const QMimeData *data, Qt::DropAction acti This signal is emitted when reset() is called, after the model's internal state (e.g. persistent model indexes) has been invalidated. - \sa reset(), modelAboutToBeReset() + \sa endResetModel(), modelAboutToBeReset() */ /*! diff --git a/src/corelib/kernel/qabstractitemmodel.h b/src/corelib/kernel/qabstractitemmodel.h index b47e4cb..1ca6cbe 100644 --- a/src/corelib/kernel/qabstractitemmodel.h +++ b/src/corelib/kernel/qabstractitemmodel.h @@ -293,6 +293,9 @@ protected: void reset(); + void beginResetModel(); + void endResetModel(); + void changePersistentIndex(const QModelIndex &from, const QModelIndex &to); void changePersistentIndexList(const QModelIndexList &from, const QModelIndexList &to); QModelIndexList persistentIndexList() const; diff --git a/src/corelib/kernel/qcore_symbian_p.cpp b/src/corelib/kernel/qcore_symbian_p.cpp index 957b92c..a263cc4 100644 --- a/src/corelib/kernel/qcore_symbian_p.cpp +++ b/src/corelib/kernel/qcore_symbian_p.cpp @@ -175,10 +175,6 @@ Q_CORE_EXPORT TLibraryFunction qt_resolveS60PluginFunc(int ordinal) return qt_s60_plugin_resolver()->resolve(ordinal); } -/*! -\internal -Provides global access to a shared RFs. -*/ class QS60RFsSession { public: diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 1f35c73..8abe28e 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -240,18 +240,20 @@ static void computeOffsets(const QMetaObject *metaobject, int *signalOffset, int } } -/*! \internal +/* This vector contains the all connections from an object. - Each object may have one vector containing the lists of connections for a given signal. - The index in the vector correspond to the signal index. - The signal index is the one returned by QObjectPrivate::signalIndex (not QMetaObject::indexOfSignal). + Each object may have one vector containing the lists of + connections for a given signal. The index in the vector correspond + to the signal index. The signal index is the one returned by + QObjectPrivate::signalIndex (not QMetaObject::indexOfSignal). Negative index means connections to all signals. This vector is protected by the object mutex (signalSlotMutexes()) - Each Connection is also part of a 'senders' linked list. The mutex of the receiver must be locked when touching - the pointers of this linked list. + Each Connection is also part of a 'senders' linked list. The mutex + of the receiver must be locked when touching the pointers of this + linked list. */ class QObjectConnectionListVector : public QVector<QObjectPrivate::ConnectionList> { |