diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-06-06 09:06:42 +0900 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-06-06 09:06:42 +0900 |
commit | cd7488491ff2a3be57ba018c4fb8f1a30d749679 (patch) | |
tree | 5cfdf90e761c6fd0f01ebddc0d70657c0fed75bf /qt-ui/divelistview.h | |
parent | 235833b93e3c065ab0759617a5a331bcdb568ddf (diff) | |
download | subsurface-cd7488491ff2a3be57ba018c4fb8f1a30d749679.tar.gz |
Implement the context menu a different way
It seems that this is the way this is supposed to be done - instead of
manually looking at what kind of click we get, Qt decides when to create
a context menu for us - this way things like the Windows Menu button
will work automagically.
As an example I also implemented the "remove dive from trip"
functionality, which exposes some other bugs (like the fact that the
dive that isn't part of a trip ends up being sorted at the very end of
the dive list).
This commit contains a "testSlot" implementation to remind me how to
figure out which dive / trip we are on.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divelistview.h')
-rw-r--r-- | qt-ui/divelistview.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/qt-ui/divelistview.h b/qt-ui/divelistview.h index 2bce35612..40e2d5892 100644 --- a/qt-ui/divelistview.h +++ b/qt-ui/divelistview.h @@ -28,21 +28,25 @@ public: bool eventFilter(QObject* , QEvent* ); void unselectDives(); void selectDive(struct dive *, bool scrollto = false); - void mousePressEvent(QMouseEvent *event); + void contextMenuEvent(QContextMenuEvent *event); public slots: void toggleColumnVisibilityByIndex(); void reloadHeaderActions(); void headerClicked(int); void showSearchEdit(); + void removeFromTrip(); + void testSlot(); Q_SIGNALS: void currentDiveChanged(int divenr); + private: bool mouseClickSelection; int currentHeaderClicked; DiveTripModel::Layout currentLayout; QLineEdit *searchBox; + QModelIndex contextMenuIndex; }; #endif // DIVELISTVIEW_H |