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.h | |
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.h')
-rw-r--r-- | src/corelib/itemmodels/qabstractitemmodel.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/corelib/itemmodels/qabstractitemmodel.h b/src/corelib/itemmodels/qabstractitemmodel.h index 1d9617e8eb..00e108099d 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.h +++ b/src/corelib/itemmodels/qabstractitemmodel.h @@ -156,6 +156,7 @@ template <class Key, class T> class QMap; class Q_CORE_EXPORT QAbstractItemModel : public QObject { Q_OBJECT + Q_ENUMS(LayoutChangeHints) friend class QPersistentModelIndexData; friend class QAbstractItemViewPrivate; @@ -237,11 +238,18 @@ public: using QObject::parent; #endif + enum LayoutChangeHint + { + NoLayoutChangeHint, + VerticalSortHint, + HorizontalSortHint + }; + Q_SIGNALS: void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>()); void headerDataChanged(Qt::Orientation orientation, int first, int last); - void layoutChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>()); - void layoutAboutToBeChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>()); + void layoutChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint); + void layoutAboutToBeChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint); void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last #if !defined(qdoc) |