mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
a180af3879
commit
c729ae92ed
2 changed files with 106 additions and 0 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue