diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-06-14 09:17:46 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-06-14 09:20:20 -0700 |
commit | a960cd2d459a04a87e3bd05ecff885c342b8e761 (patch) | |
tree | 61fef55398b1c49e7c465ffc57b11538769796af /qt-ui/divelistview.cpp | |
parent | 8669de63e137aa873a8cf843ad79fffaee0afa40 (diff) | |
download | subsurface-a960cd2d459a04a87e3bd05ecff885c342b8e761.tar.gz |
Show & edit trip location and notes when exactly one trip is selected
While we still show the selected_dive in the profile and use it for Dive
Info and Equipment, in the Dive Notes tab we now show the trip location
and trip notes (and none of the other fields), if the user directly
selects a whole trip by clicking on the trip header.
This clever reuse of the widget now allows trip location and notes to be
edited in place.
As a side note: the Gtk version has long allowed the user to edit the
trip location and trip notes, but nowhere did it ever SHOW the trip
notes... so this is more than just feature parity...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divelistview.cpp')
-rw-r--r-- | qt-ui/divelistview.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index 12243f468..752e12242 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -42,6 +42,7 @@ DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelec searchBox->hide(); connect(showSearchBox, SIGNAL(triggered(bool)), this, SLOT(showSearchEdit())); connect(searchBox, SIGNAL(textChanged(QString)), model, SLOT(setFilterFixedString(QString))); + selectedTrips.clear(); } void DiveListView::fixMessyQtModelBehaviour() @@ -253,6 +254,8 @@ void DiveListView::selectionChanged(const QItemSelection& selected, const QItemS if (!dive) { // it's a trip! if (model->rowCount(index)) { struct dive *child = (struct dive*) model->data(index.child(0,0), TreeItemDT::DIVE_ROLE).value<void*>(); + if (child && child->divetrip) + selectedTrips.remove(child->divetrip); while (child) { deselect_dive(get_index_for_dive(child)); child = child->next; @@ -272,6 +275,8 @@ void DiveListView::selectionChanged(const QItemSelection& selected, const QItemS if (model->rowCount(index)) { QItemSelection selection; struct dive *child = (struct dive*) model->data(index.child(0,0), TreeItemDT::DIVE_ROLE).value<void*>(); + if (child && child->divetrip) + selectedTrips.insert(child->divetrip); while (child) { select_dive(get_index_for_dive(child)); child = child->next; |