From 4a087d3e4548ba9ac3cdf7f27858f05e80d063b7 Mon Sep 17 00:00:00 2001 From: Andreas Eliasson Date: Fri, 5 Jul 2024 12:48:34 +0200 Subject: [PATCH] Doc: Add note about sortColumn() and sort() behavior While available in their respective function level descriptions, add a note about the behavior of the sortColumn() and sort() functions in the sorting section of QSortFilterProxyModel's detailed description in order to promote this information to the reader. Fixes: QTBUG-125718 Pick-to: 6.7 6.5 Change-Id: Ib7a3c206cd49b446b11063850d294da0811a282c Reviewed-by: Fabian Kosmale (cherry picked from commit 014d2f075ebf811e560aad89a4e8de491e3a179c) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/itemmodels/qsortfilterproxymodel.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp index f6c6c89c8e6..73da00642a7 100644 --- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp +++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp @@ -1943,6 +1943,11 @@ void QSortFilterProxyModelPrivate::_q_sourceColumnsMoved( QSortFilterProxyModel can be sorted by column -1, in which case it returns to the sort order of the underlying source model. + \note \l sortColumn() returns the most recently used sort column. + The default value is -1, which means that this proxy model does not sort. + Also, note that \l sort() sets the \l sortColumn() to the most recently + used sort column. + \section1 Filtering In addition to sorting, QSortFilterProxyModel can be used to hide items @@ -2496,6 +2501,8 @@ QSize QSortFilterProxyModel::span(const QModelIndex &index) const Sorts the model by \a column in the given \a order. If the sort \a column is less than zero, the model will be sorted by source model row in the given \a order. + + \sa sortColumn() */ void QSortFilterProxyModel::sort(int column, Qt::SortOrder order) {