diff options
author | Martin Braun <martin@gnuradio.org> | 2020-05-21 12:51:03 -0700 |
---|---|---|
committer | Martin Braun <martin@gnuradio.org> | 2020-05-22 14:26:20 -0700 |
commit | ffe8c748077b33d9dd908f487572c2cc08d46bcf (patch) | |
tree | a24c84cb017d0c3232e9923fbe5a865815bec26b /gr-qtgui | |
parent | bd91452db084ae96e5ab36f82c723b54bf106e9a (diff) |
qtgui: Apply unit of frequency sink to mouseover
The mouse hover feature of the frequency sink now respects the unit that
was set in the API.
Diffstat (limited to 'gr-qtgui')
-rw-r--r-- | gr-qtgui/lib/FrequencyDisplayPlot.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gr-qtgui/lib/FrequencyDisplayPlot.cc b/gr-qtgui/lib/FrequencyDisplayPlot.cc index 7ae3c8925b..f9a4084c9e 100644 --- a/gr-qtgui/lib/FrequencyDisplayPlot.cc +++ b/gr-qtgui/lib/FrequencyDisplayPlot.cc @@ -39,20 +39,24 @@ public: void setUnitType(const std::string& type) { d_unitType = type; } + void setYUnit(const std::string& unit) { d_y_unit = unit; } + protected: using QwtPlotZoomer::trackerText; virtual QwtText trackerText(QPoint const& p) const { QwtDoublePoint dp = QwtPlotZoomer::invTransform(p); - QwtText t(QString("%1 %2, %3 dB") + QwtText t(QString("%1 %2, %3 %4") .arg(dp.x(), 0, 'f', getFrequencyPrecision()) .arg(d_unitType.c_str()) - .arg(dp.y(), 0, 'f', 2)); + .arg(dp.y(), 0, 'f', 2) + .arg(d_y_unit.c_str())); return t; } private: std::string d_unitType; + std::string d_y_unit = "dB"; }; @@ -553,6 +557,7 @@ void FrequencyDisplayPlot::setYLabel(const std::string& label, const std::string if (unit.length() > 0) l += " (" + unit + ")"; setAxisTitle(QwtPlot::yLeft, QString(l.c_str())); + static_cast<FreqDisplayZoomer*>(d_zoomer)->setYUnit(unit); } void FrequencyDisplayPlot::setMinFFTColor(QColor c) |