diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-05-12 06:54:34 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-05-12 06:58:56 -0700 |
commit | c729ae92ed1ea444ed2c9a38178ebe4cb22e54c4 (patch) | |
tree | 82a933a1a9b0022721cc7dfc531648d27b0a6e6c /qt-ui/mainwindow.h | |
parent | a180af38797f23b975bc092cf75e9703c4c93921 (diff) | |
download | subsurface-c729ae92ed1ea444ed2c9a38178ebe4cb22e54c4.tar.gz |
Allow walking the dive list with the cursor keys
Figure out what is our first selected element (in case we start out from a
multiple selection) and then move to the next logical element. So the code
traverses an expanded tree (from a trip 'down' to its first dive or 'up'
to the last dive of the previous trip - and similar from a first dive in a
trip 'up' to its trip and from a last dive in a trip 'down' to the next
trip.
This does not take 'shift-cursor-up/down' into account (i.e. manual
selection extension). Instead with just cursor up and down a single dive
(or single trip) is selected.
My guess is that the code will make someone's eyes bleed. Be warned.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/mainwindow.h')
-rw-r--r-- | qt-ui/mainwindow.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h index b76199a8b..8c07d048c 100644 --- a/qt-ui/mainwindow.h +++ b/qt-ui/mainwindow.h @@ -9,6 +9,7 @@ #include <QMainWindow> #include <QModelIndex> +#include <QAction> class QSortFilterProxyModel; class DiveTripModel; @@ -68,6 +69,10 @@ private Q_SLOTS: void on_actionAboutSubsurface_triggered(); void on_actionUserManual_triggered(); + /* keyboard actions */ + void nextDive_triggered(); + void previousDive_triggered(); + void dive_selection_changed(const QItemSelection& newSelection, const QItemSelection& oldSelection); @@ -78,6 +83,9 @@ private: Ui::MainWindow *ui; DiveTripModel *model; QSortFilterProxyModel *sortModel; + QAction *actionNextDive; + QAction *actionPreviousDive; + QString filter(); bool askSaveChanges(); void readSettings(); |