From 6d648961c693a3b2319d9ea8974547bd2b4bbece Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Thu, 20 Sep 2018 22:58:07 +0200 Subject: QItemWidgets: emit layoutChanged with proper sortHint layout(AboutToBe)Changed gained a sortHint parameter with Qt5.0 but the itemmodels did not set a proper value where possible. Since the sorting of the ItemWidgets is only per column, it is reasonable to pass QAbstractItemModel::VerticalSortHint in the various layoutChanged calls. Change-Id: Ia11322bae1a96bc0d7d8422558a11cdfe04c2808 Reviewed-by: Samuel Gaist Reviewed-by: Richard Moe Gustavsen --- src/widgets/itemviews/qtreewidget.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/widgets/itemviews/qtreewidget.cpp') diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index a898661963..4768869843 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -656,7 +656,7 @@ void QTreeModel::ensureSorted(int column, Qt::SortOrder order, // we are going to change the persistent indexes, so we need to prepare if (!changed) { // this will only happen once changed = true; - emit layoutAboutToBeChanged(); // the selection model needs to know + emit layoutAboutToBeChanged({parent}, QAbstractItemModel::VerticalSortHint); // the selection model needs to know oldPersistentIndexes = persistentIndexList(); newPersistentIndexes = oldPersistentIndexes; } @@ -689,7 +689,7 @@ void QTreeModel::ensureSorted(int column, Qt::SortOrder order, if (changed) { itm->children = lst; changePersistentIndexList(oldPersistentIndexes, newPersistentIndexes); - emit layoutChanged(); + emit layoutChanged({parent}, QAbstractItemModel::VerticalSortHint); } } @@ -2185,9 +2185,9 @@ void QTreeWidgetItem::sortChildren(int column, Qt::SortOrder order, bool climb) QTreeModel::SkipSorting skipSorting(model); int oldSortColumn = view->d_func()->explicitSortColumn; view->d_func()->explicitSortColumn = column; - emit model->layoutAboutToBeChanged(); + emit model->layoutAboutToBeChanged({}, QAbstractItemModel::VerticalSortHint); d->sortChildren(column, order, climb); - emit model->layoutChanged(); + emit model->layoutChanged({}, QAbstractItemModel::VerticalSortHint); view->d_func()->explicitSortColumn = oldSortColumn; } -- cgit v1.2.3