summaryrefslogtreecommitdiffstats
path: root/qt-ui/divelistview.cpp
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2013-05-29 14:54:39 +0900
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-29 20:10:20 +0900
commitbb77f5a44e4c5d7a85e500437e69beb4ed38f264 (patch)
tree5c48c2d50799220b7d8a9eb97a5d9110e70e26bf /qt-ui/divelistview.cpp
parent8df20f414966db685e4709eb101e071b4783c09f (diff)
downloadsubsurface-bb77f5a44e4c5d7a85e500437e69beb4ed38f264.tar.gz
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 <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divelistview.cpp')
-rw-r--r--qt-ui/divelistview.cpp1
1 files changed, 1 insertions, 0 deletions
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);