mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-01 00:33:24 +00:00
Hide current dive site from dive sites with same coordinates.
Signed-off-by: Sander Kleijwegt <sander@myowndomain.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
8dafc32228
commit
6427564d33
2 changed files with 7 additions and 8 deletions
|
@ -189,6 +189,7 @@ bool filter_same_gps_cb (QAbstractItemModel *model, int sourceRow, const QModelI
|
||||||
{
|
{
|
||||||
int ref_lat = displayed_dive_site.latitude.udeg;
|
int ref_lat = displayed_dive_site.latitude.udeg;
|
||||||
int ref_lon = displayed_dive_site.longitude.udeg;
|
int ref_lon = displayed_dive_site.longitude.udeg;
|
||||||
|
int ref_uuid = displayed_dive_site.uuid;
|
||||||
QSortFilterProxyModel *self = (QSortFilterProxyModel*) model;
|
QSortFilterProxyModel *self = (QSortFilterProxyModel*) model;
|
||||||
|
|
||||||
int ds_uuid = self->sourceModel()->index(sourceRow, LocationInformationModel::UUID, parent).data().toInt();
|
int ds_uuid = self->sourceModel()->index(sourceRow, LocationInformationModel::UUID, parent).data().toInt();
|
||||||
|
@ -197,5 +198,5 @@ bool filter_same_gps_cb (QAbstractItemModel *model, int sourceRow, const QModelI
|
||||||
if (!ds)
|
if (!ds)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return (ds->latitude.udeg == ref_lat && ds->longitude.udeg == ref_lon);
|
return (ds->latitude.udeg == ref_lat && ds->longitude.udeg == ref_lon && ds->uuid != ref_uuid);
|
||||||
}
|
}
|
|
@ -55,13 +55,11 @@ LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBo
|
||||||
bool LocationInformationWidget::eventFilter(QObject*, QEvent *ev)
|
bool LocationInformationWidget::eventFilter(QObject*, QEvent *ev)
|
||||||
{
|
{
|
||||||
if( ev->type() == QEvent::ContextMenu ) {
|
if( ev->type() == QEvent::ContextMenu ) {
|
||||||
if (ui.diveSiteListView->selectionModel()->selectedIndexes().count() >= 2) {
|
QContextMenuEvent *ctx = (QContextMenuEvent*) ev;
|
||||||
QContextMenuEvent *ctx = (QContextMenuEvent*) ev;
|
QMenu contextMenu;
|
||||||
QMenu contextMenu;
|
contextMenu.addAction(tr("Merge into current site"), this, SLOT(mergeSelectedDiveSites()));
|
||||||
contextMenu.addAction(tr("Merge dive Sites"), this, SLOT(mergeSelectedDiveSites()));
|
contextMenu.exec(ctx->globalPos());
|
||||||
contextMenu.exec(ctx->globalPos());
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue