diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2013-05-28 16:56:58 -0300 |
---|---|---|
committer | Tomaz Canabrava <tcanabrava@kde.org> | 2013-05-28 16:56:58 -0300 |
commit | c6f84de37c33ef66f479d1adcffea6eab903c674 (patch) | |
tree | 8693cfa163a2ece07d281b8a860c650469990a12 /qt-ui/divelistview.cpp | |
parent | 8394828806baf050fa833402c969139d52dc221d (diff) | |
download | subsurface-c6f84de37c33ef66f479d1adcffea6eab903c674.tar.gz |
Adds the code to make the dive list behave like tree or list
This code adds the possibility to make the DiveList behave
like a Tree or a List, depending on what layout is set.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui/divelistview.cpp')
-rw-r--r-- | qt-ui/divelistview.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index 4957e3374..d53fce5f5 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -22,6 +22,7 @@ DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelec setItemDelegateForColumn(TreeItemDT::RATING, new StarWidgetsDelegate()); QSortFilterProxyModel *model = new QSortFilterProxyModel(this); setModel(model); + setSortingEnabled(false); header()->setContextMenuPolicy(Qt::ActionsContextMenu); } @@ -31,7 +32,10 @@ void DiveListView::reload() QAbstractItemModel *oldModel = m->sourceModel(); if (oldModel) oldModel->deleteLater(); - m->setSourceModel(new DiveTripModel(this)); + DiveTripModel *tripModel = new DiveTripModel(this); + tripModel->setLayout(DiveTripModel::LIST); + + m->setSourceModel(tripModel); sortByColumn(0, Qt::DescendingOrder); QModelIndex firstDiveOrTrip = m->index(0,0); if (firstDiveOrTrip.isValid()) { |