From bb77f5a44e4c5d7a85e500437e69beb4ed38f264 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Wed, 29 May 2013 14:54:39 +0900 Subject: Add a "sort role" for sorting the dive list By default, sorting is done by the display role, but then we end up sorting by the string we display, which is almost always the wrong thing. So this adds a new "SORT_ROLE" that is used for sorting, and then the data lookup can return the raw data we want to sort by. Signed-off-by: Linus Torvalds Signed-off-by: Dirk Hohndel --- qt-ui/divelistview.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'qt-ui/divelistview.cpp') diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index 948bfa57a..0e3f62793 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -21,6 +21,7 @@ DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelec setUniformRowHeights(true); setItemDelegateForColumn(TreeItemDT::RATING, new StarWidgetsDelegate()); QSortFilterProxyModel *model = new QSortFilterProxyModel(this); + model->setSortRole(TreeItemDT::SORT_ROLE); setModel(model); setSortingEnabled(false); header()->setContextMenuPolicy(Qt::ActionsContextMenu); -- cgit v1.2.3-70-g09d2