diff options
author | Jerome Pasion <jerome.pasion@nokia.com> | 2011-07-08 11:17:37 (GMT) |
---|---|---|
committer | Jerome Pasion <jerome.pasion@nokia.com> | 2011-07-08 11:17:37 (GMT) |
commit | f037c0e87d186a01f07cb9aa360dcc496d11145e (patch) | |
tree | 9449cc65b856b4743e933cf2b8ae1cb2f85ba9fd /src/corelib/kernel/qabstractitemmodel.cpp | |
parent | 5016de08d84c4d2887f7424dbf17f31e27c2e8e2 (diff) | |
parent | 1dd26ea2486db87b61e8e9f70a1e04f7386405ef (diff) | |
download | Qt-f037c0e87d186a01f07cb9aa360dcc496d11145e.zip Qt-f037c0e87d186a01f07cb9aa360dcc496d11145e.tar.gz Qt-f037c0e87d186a01f07cb9aa360dcc496d11145e.tar.bz2 |
Merge remote branch 'upstream/4.8'
Conflicts:
doc/src/external-resources.qdoc
Diffstat (limited to 'src/corelib/kernel/qabstractitemmodel.cpp')
-rw-r--r-- | src/corelib/kernel/qabstractitemmodel.cpp | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp index b7ac6aa..ddf1fbb 100644 --- a/src/corelib/kernel/qabstractitemmodel.cpp +++ b/src/corelib/kernel/qabstractitemmodel.cpp @@ -1348,6 +1348,26 @@ void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent, */ /*! + \since 4.8 + + This slot is called just after the internal data of a model is cleared + while it is being reset. + + This slot is provided the convenience of subclasses of concrete proxy + models, such as subclasses of QSortFilterProxyModel which maintain extra + data. + + \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 10 + + \sa modelAboutToBeReset(), modelReset() +*/ +void QAbstractItemModel::resetInternalData() +{ + +} + + +/*! Constructs an abstract item model with the given \a parent. */ QAbstractItemModel::QAbstractItemModel(QObject *parent) @@ -1747,18 +1767,19 @@ QMimeData *QAbstractItemModel::mimeData(const QModelIndexList &indexes) const Returns true if the data and action can be handled by the model; otherwise returns false. - Although the specified \a row, \a column and \a parent indicate the - location of an item in the model where the operation ended, it is the - responsibility of the view to provide a suitable location for where the - data should be inserted. + The specified \a row, \a column and \a parent indicate the location of an + item in the model where the operation ended. It is the responsibility of + the model to complete the action at the correct location. For instance, a drop action on an item in a QTreeView can result in new items either being inserted as children of the item specified by \a row, \a column, and \a parent, or as siblings of the item. - When row and column are -1 it means that it is up to the model to decide - where to place the data. This can occur in a tree when data is dropped on - a parent. Models will usually append the data to the parent in this case. + When \a row and \a column are -1 it means that the dropped data should be + considered as dropped directly on \a parent. Usually this will mean + appending the data as child items of \a parent. If \a row and column are + greater than or equal zero, it means that the drop occurred just before the + specified \a row and \a column in the specified \a parent. \sa supportedDropActions(), {Using drag and drop with item views} */ @@ -2888,6 +2909,7 @@ void QAbstractItemModel::reset() Q_D(QAbstractItemModel); emit modelAboutToBeReset(); d->invalidatePersistentIndexes(); + QMetaObject::invokeMethod(this, "resetInternalData"); emit modelReset(); } @@ -2930,6 +2952,7 @@ void QAbstractItemModel::endResetModel() { Q_D(QAbstractItemModel); d->invalidatePersistentIndexes(); + QMetaObject::invokeMethod(this, "resetInternalData"); emit modelReset(); } |