summaryrefslogtreecommitdiffstats
path: root/qt-ui/locationinformation.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-08-31 21:11:28 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-08-31 18:42:56 -0700
commit560426bf82ef7cb163d8046b722c12b76604006c (patch)
tree59973bb1bb0b077e4c097e85f13d227860bc00ba /qt-ui/locationinformation.cpp
parentb52b95f3ec2e0dc730f991f25b7cefe30750cc72 (diff)
downloadsubsurface-560426bf82ef7cb163d8046b722c12b76604006c.tar.gz
Offer the option to merge dive sites.
Almost finishing. :) Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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)