summaryrefslogtreecommitdiffstats
path: root/qt-ui/locationinformation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/locationinformation.cpp')
-rw-r--r--qt-ui/locationinformation.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp
index 616a7147e..b3acc6682 100644
--- a/qt-ui/locationinformation.cpp
+++ b/qt-ui/locationinformation.cpp
@@ -10,6 +10,7 @@
#include <QDebug>
#include <QShowEvent>
+#include <QItemSelectionModel>
LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBox(parent), modified(false)
{
@@ -35,7 +36,7 @@ LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBo
filter_model->setFilterRow(filter_same_gps_cb);
ui.diveSiteListView->setModel(filter_model);
ui.diveSiteListView->setModelColumn(LocationInformationModel::NAME);
-
+ ui.diveSiteListView->installEventFilter(this);
#ifndef NO_MARBLE
// Globe Management Code.
connect(this, &LocationInformationWidget::requestCoordinates,
@@ -49,6 +50,18 @@ LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBo
#endif
}
+bool LocationInformationWidget::eventFilter(QObject*, QEvent *ev)
+{
+ if( ev->type() == QEvent::ContextMenu ) {
+ if (ui.diveSiteListView->selectionModel()->selectedIndexes().count() >= 2) {
+ QContextMenuEvent *ctx = (QContextMenuEvent*) ev;
+ QMenu contextMenu;
+ contextMenu.addAction(tr("Merge dive Sites"), this, SLOT(merge_dive_sites()));
+ contextMenu.exec(ctx->globalPos());
+ }
+ }
+}
+
void LocationInformationWidget::updateLabels()
{
if (displayed_dive_site.name)