From f8d530db4ccbcfd50d280a46b40d3125aadae671 Mon Sep 17 00:00:00 2001 From: Ale Martinez Date: Sun, 24 Mar 2019 19:42:44 -0300 Subject: [PATCH] Double-click on LTMPopup ride list selects Activity and Activities view Fixes #922 --- src/Charts/LTMPopup.cpp | 24 ++++++++++++++++++++++++ src/Charts/LTMPopup.h | 1 + 2 files changed, 25 insertions(+) diff --git a/src/Charts/LTMPopup.cpp b/src/Charts/LTMPopup.cpp index 13d7779a9..aedc50683 100644 --- a/src/Charts/LTMPopup.cpp +++ b/src/Charts/LTMPopup.cpp @@ -103,6 +103,7 @@ LTMPopup::LTMPopup(Context *context) : QWidget(context->mainWindow), context(con mainLayout->addWidget(notes); connect(rides, SIGNAL(itemSelectionChanged()), this, SLOT(rideSelected())); + connect(rides, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), this, SLOT(rideOpen())); } @@ -518,6 +519,29 @@ LTMPopup::rideSelected() resizeEvent(NULL); } +void +LTMPopup::rideOpen() +{ + // which ride is selected + int index = 0; + if (rides->selectedItems().count()) + index = rides->selectedItems().first()->row(); + + // do we have any rides and is the index within bounds + if (selected.count() > index) { + + RideItem *have = context->athlete->rideCache->getRide(selected[index]); + + if (have) { + + // Select Activity in Activities view + context->notifyRideSelected(have); + // Select Activities view + context->mainWindow->selectAnalysis(); + } + } +} + void LTMPopup::resizeEvent(QResizeEvent *) { diff --git a/src/Charts/LTMPopup.h b/src/Charts/LTMPopup.h index df91fead5..8f4850291 100644 --- a/src/Charts/LTMPopup.h +++ b/src/Charts/LTMPopup.h @@ -59,6 +59,7 @@ class LTMPopup : public QWidget private slots: void rideSelected(); // scrolling up and down the popup ride list + void rideOpen(); // double click an item on the popup ride list virtual void resizeEvent(QResizeEvent *); bool eventFilter(QObject *object, QEvent *e);