From a3ec5d5729542de406e9f0457748f1dde1cf5662 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 27 Sep 2012 11:08:18 +0200 Subject: 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 Reviewed-by: Stephen Kelly --- src/corelib/itemmodels/qabstractitemmodel.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/corelib/itemmodels/qabstractitemmodel.h') 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 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 &roles = QVector()); void headerDataChanged(Qt::Orientation orientation, int first, int last); - void layoutChanged(const QList &parents = QList()); - void layoutAboutToBeChanged(const QList &parents = QList()); + void layoutChanged(const QList &parents = QList(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint); + void layoutAboutToBeChanged(const QList &parents = QList(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint); void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last #if !defined(qdoc) -- cgit v1.2.3