mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 20:23:25 +00:00
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>
This commit is contained in:
parent
b52b95f3ec
commit
560426bf82
3 changed files with 20 additions and 1 deletions
|
@ -98,6 +98,9 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::MultiSelection</enum>
|
||||
</property>
|
||||
<property name="modelColumn">
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -9,6 +9,8 @@ class LocationInformationWidget : public QGroupBox {
|
|||
Q_OBJECT
|
||||
public:
|
||||
LocationInformationWidget(QWidget *parent = 0);
|
||||
virtual bool eventFilter(QObject*, QEvent*);
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *);
|
||||
|
||||
|
@ -35,6 +37,7 @@ signals:
|
|||
void stopFilterDiveSite();
|
||||
void requestCoordinates();
|
||||
void endRequestCoordinates();
|
||||
|
||||
private:
|
||||
Ui::LocationInformation ui;
|
||||
bool modified;
|
||||
|
|
Loading…
Add table
Reference in a new issue