diff --git a/src/applications/gqrx/mainwindow.cpp b/src/applications/gqrx/mainwindow.cpp index 145245497..750550889 100644 --- a/src/applications/gqrx/mainwindow.cpp +++ b/src/applications/gqrx/mainwindow.cpp @@ -275,6 +275,7 @@ MainWindow::MainWindow(const QString& cfgfile, bool edit_conf, QWidget *parent) // Bookmarks connect(uiDockBookmarks, SIGNAL(newBookmarkActivated(qint64, QString, int)), this, SLOT(onBookmarkActivated(qint64, QString, int))); + connect(ui->plotter, SIGNAL(newBookmarkActivated(qint64, QString, int)), this, SLOT(onBookmarkActivated(qint64, QString, int))); connect(uiDockBookmarks->actionAddBookmark, SIGNAL(triggered()), this, SLOT(on_actionAddBookmark_triggered())); //DXC Spots diff --git a/src/qtgui/plotter.cpp b/src/qtgui/plotter.cpp index b7613fbc5..7e1ac6ad5 100644 --- a/src/qtgui/plotter.cpp +++ b/src/qtgui/plotter.cpp @@ -176,6 +176,23 @@ QSize CPlotter::sizeHint() const return {180, 180}; } +void CPlotter::mouseDoubleClickEvent(QMouseEvent* event) +{ + if (m_CursorCaptured == TAG) + { + for (auto & tag : m_Taglist) + { + if (tag.first.contains(event->pos())) + { + const BookmarkInfo &b = tag.second; + + emit newBookmarkActivated(b.frequency, b.modulation, b.bandwidth); + break; + } + } + } +} + void CPlotter::mouseMoveEvent(QMouseEvent* event) { @@ -675,7 +692,8 @@ void CPlotter::mousePressEvent(QMouseEvent * event) { if (tag.first.contains(event->pos())) { - m_DemodCenterFreq = tag.second; + m_DemodCenterFreq = tag.second.frequency; + emit newDemodFreq(m_DemodCenterFreq, m_DemodCenterFreq - m_CenterFreq); break; } @@ -1346,7 +1364,7 @@ void CPlotter::drawOverlay() const auto levelNHeightBottom = levelNHeight + fontHeight; const auto levelNHeightBottomSlant = levelNHeightBottom + slant; - m_Taglist.append(qMakePair(QRect(x, levelNHeight, nameWidth + slant, fontHeight), tag.frequency)); + m_Taglist.append(qMakePair(QRect(x, levelNHeight, nameWidth + slant, fontHeight), tag)); QColor color = QColor(tag.GetColor()); color.setAlpha(0x60); diff --git a/src/qtgui/plotter.h b/src/qtgui/plotter.h index ebb3cdbec..6aeef6528 100644 --- a/src/qtgui/plotter.h +++ b/src/qtgui/plotter.h @@ -9,6 +9,8 @@ #include #include +#include "bookmarks.h" + #define HORZ_DIVS_MAX 12 //50 #define VERT_DIVS_MIN 5 #define MAX_SCREENSIZE 16384 @@ -131,6 +133,7 @@ class CPlotter : public QFrame void pandapterRangeChanged(float min, float max); void newZoomLevel(float level); void newSize(); + void newBookmarkActivated(qint64 frequency, const QString &modulation, int bandwidth); public slots: // zoom functions @@ -162,6 +165,7 @@ public slots: //re-implemented widget event handlers void paintEvent(QPaintEvent *event) override; void resizeEvent(QResizeEvent* event) override; + void mouseDoubleClickEvent(QMouseEvent * event) override; void mouseMoveEvent(QMouseEvent * event) override; void mousePressEvent(QMouseEvent * event) override; void mouseReleaseEvent(QMouseEvent * event) override; @@ -278,7 +282,7 @@ public slots: float m_PeakDetection{}; QMap m_Peaks; - QList< QPair > m_Taglist; + QList< QPair > m_Taglist; // Waterfall averaging quint64 tlast_wf_ms; // last time waterfall has been updated