diff options
author | Stephen Kelly <stephen.kelly@kdab.com> | 2012-09-27 11:08:18 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-09-29 14:17:34 +0200 |
commit | a3ec5d5729542de406e9f0457748f1dde1cf5662 (patch) | |
tree | 07bd860eb57647f2a55a800d06d345a0510e3468 /src/corelib/itemmodels/qabstractitemmodel.cpp | |
parent | 9801b2c9960aa5512aa78828c460a76e6224e5d6 (diff) |
Add hint API to QAIM::layout*Change signals.
Usually layoutChange is used for sorting elements. The parents parameter
to the signal already hints at a localization of what is being sorted, if
it's just one level in the tree. The new hints enum can be used to only
consider how the first column of a table gets sorted, because all other
columns will be sorted the same way.
Change-Id: I65dd2996894bbdb45a2f6288edbeaa49e4053256
Reviewed-by: David Faure <faure@kde.org>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'src/corelib/itemmodels/qabstractitemmodel.cpp')
-rw-r--r-- | src/corelib/itemmodels/qabstractitemmodel.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index 77654158d1..9fc68711f6 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -1322,9 +1322,20 @@ void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent, \sa headerData(), setHeaderData(), dataChanged() */ + /*! - \fn void QAbstractItemModel::layoutAboutToBeChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>()) - \since 4.2 + \enum QAbstractItemModel::LayoutChangeHint + + This enum describes the way the model changes layout. + + \value NoLayoutChangeHint No hint is available. + \value VerticalSortHint Rows are being sorted. + \value HorizontalSortHint Columns are being sorted. +*/ + +/*! + \fn void QAbstractItemModel::layoutAboutToBeChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint) + \since 5.0 This signal is emitted just before the layout of a model is changed. Components connected to this signal use it to adapt to changes in the @@ -1335,13 +1346,15 @@ void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent, The optional \a parents parameter is used to give a more specific notification about what parts of the layout of the model are changing. An empty list indicates - a change to the layout of the entire model. + a change to the layout of the entire model. The order of elements in the \a parents list is not significant. The optional \a hint parameter is used + to give a hint about what is happening while the model is relayouting. \sa layoutChanged(), changePersistentIndex() */ /*! - \fn void QAbstractItemModel::layoutChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>()) + \fn void QAbstractItemModel::layoutChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint) + \since 5.0 This signal is emitted whenever the layout of items exposed by the model has changed; for example, when the model has been sorted. When this signal @@ -1355,7 +1368,8 @@ void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent, The optional \a parents parameter is used to give a more specific notification about what parts of the layout of the model are changing. An empty list indicates - a change to the layout of the entire model. + a change to the layout of the entire model. The order of elements in the \a parents list is not significant. The optional \a hint parameter is used + to give a hint about what is happening while the model is relayouting. Subclasses should update any persistent model indexes before emitting layoutChanged(). In other words, when the structure changes: |