From e00ff78c9c2278cdf41e7197389cec707a30c672 Mon Sep 17 00:00:00 2001 From: Bill Muzika Date: Fri, 3 Sep 2021 00:40:22 -0400 Subject: [PATCH] qt-gui: enables use of Qwt 6.2 Adds the typedefs and includes needed to build with Qwt 6.2. Signed-off-by: Bill Muzika --- gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h | 5 ++++- gr-qtgui/include/gnuradio/qtgui/TimeRasterDisplayPlot.h | 4 +++- gr-qtgui/include/gnuradio/qtgui/WaterfallDisplayPlot.h | 4 +++- gr-qtgui/include/gnuradio/qtgui/plot_raster.h | 6 ++++-- gr-qtgui/include/gnuradio/qtgui/plot_waterfall.h | 6 ++++-- gr-qtgui/include/gnuradio/qtgui/qtgui_types.h | 1 + gr-qtgui/include/gnuradio/qtgui/timeRasterGlobalData.h | 9 +++++++-- gr-qtgui/include/gnuradio/qtgui/waterfallGlobalData.h | 9 +++++++-- gr-qtgui/lib/ConstellationDisplayPlot.cc | 1 + gr-qtgui/lib/plot_raster.cc | 9 +++++++++ gr-qtgui/lib/plot_waterfall.cc | 9 +++++++++ gr-qtgui/lib/timeRasterGlobalData.cc | 7 +++++++ gr-qtgui/lib/waterfallGlobalData.cc | 6 ++++++ 13 files changed, 65 insertions(+), 11 deletions(-) diff --git a/gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h b/gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h index 04de962fa3d..4e8afa26794 100644 --- a/gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h +++ b/gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h @@ -29,7 +29,10 @@ #include #if QWT_VERSION >= 0x060000 -#include +typedef QPointF QwtDoublePoint; +typedef QRectF QwtDoubleRect; + +typedef QwtInterval QwtDoubleInterval; #endif typedef QList QColorList; diff --git a/gr-qtgui/include/gnuradio/qtgui/TimeRasterDisplayPlot.h b/gr-qtgui/include/gnuradio/qtgui/TimeRasterDisplayPlot.h index 170b62cafbf..09bad218bee 100644 --- a/gr-qtgui/include/gnuradio/qtgui/TimeRasterDisplayPlot.h +++ b/gr-qtgui/include/gnuradio/qtgui/TimeRasterDisplayPlot.h @@ -23,7 +23,9 @@ #if QWT_VERSION < 0x060000 #include #else -#include +#include + +typedef QwtInterval QwtDoubleInterval; #endif /*! diff --git a/gr-qtgui/include/gnuradio/qtgui/WaterfallDisplayPlot.h b/gr-qtgui/include/gnuradio/qtgui/WaterfallDisplayPlot.h index ed2196b63ef..afe7a6a6774 100644 --- a/gr-qtgui/include/gnuradio/qtgui/WaterfallDisplayPlot.h +++ b/gr-qtgui/include/gnuradio/qtgui/WaterfallDisplayPlot.h @@ -22,7 +22,9 @@ #if QWT_VERSION < 0x060000 #include #else -#include +#include + +typedef QwtInterval QwtDoubleInterval; #endif /*! diff --git a/gr-qtgui/include/gnuradio/qtgui/plot_raster.h b/gr-qtgui/include/gnuradio/qtgui/plot_raster.h index dc7ee543872..4b4c4f2afb2 100644 --- a/gr-qtgui/include/gnuradio/qtgui/plot_raster.h +++ b/gr-qtgui/include/gnuradio/qtgui/plot_raster.h @@ -16,8 +16,10 @@ #include #if QWT_VERSION >= 0x060000 -#include -#include // doesn't seem necessary, but is... +#include +#include + +typedef QwtInterval QwtDoubleInterval; #endif class QwtColorMap; diff --git a/gr-qtgui/include/gnuradio/qtgui/plot_waterfall.h b/gr-qtgui/include/gnuradio/qtgui/plot_waterfall.h index c3dba76bb95..f40446e25ca 100644 --- a/gr-qtgui/include/gnuradio/qtgui/plot_waterfall.h +++ b/gr-qtgui/include/gnuradio/qtgui/plot_waterfall.h @@ -16,8 +16,10 @@ #include #if QWT_VERSION >= 0x060000 -#include -#include // doesn't seem necessary, but is... +#include +#include + +typedef QwtInterval QwtDoubleInterval; #endif class QwtColorMap; diff --git a/gr-qtgui/include/gnuradio/qtgui/qtgui_types.h b/gr-qtgui/include/gnuradio/qtgui/qtgui_types.h index e2735cf945d..670876afc7c 100644 --- a/gr-qtgui/include/gnuradio/qtgui/qtgui_types.h +++ b/gr-qtgui/include/gnuradio/qtgui/qtgui_types.h @@ -14,6 +14,7 @@ #include #include #include +#include namespace gr { namespace qtgui { diff --git a/gr-qtgui/include/gnuradio/qtgui/timeRasterGlobalData.h b/gr-qtgui/include/gnuradio/qtgui/timeRasterGlobalData.h index 09cd42883cd..5c743f4cad5 100644 --- a/gr-qtgui/include/gnuradio/qtgui/timeRasterGlobalData.h +++ b/gr-qtgui/include/gnuradio/qtgui/timeRasterGlobalData.h @@ -15,8 +15,9 @@ #include #if QWT_VERSION >= 0x060000 -#include -#include // doesn't seem necessary, but is... +#include + +typedef QwtInterval QwtDoubleInterval; #endif class TimeRasterData : public QwtRasterData @@ -35,6 +36,9 @@ class TimeRasterData : public QwtRasterData #if QWT_VERSION < 0x060000 virtual QwtDoubleInterval range() const; virtual void setRange(const QwtDoubleInterval&); +#else + virtual QwtInterval interval(Qt::Axis) const; + void setInterval(Qt::Axis, const QwtInterval&); #endif double value(double x, double y) const override; @@ -56,6 +60,7 @@ class TimeRasterData : public QwtRasterData QwtDoubleInterval d_intensityRange; #else QwtInterval d_intensityRange; + QwtInterval d_intervals[3]; #endif private: diff --git a/gr-qtgui/include/gnuradio/qtgui/waterfallGlobalData.h b/gr-qtgui/include/gnuradio/qtgui/waterfallGlobalData.h index 03d9d13dc6a..9895e658c62 100644 --- a/gr-qtgui/include/gnuradio/qtgui/waterfallGlobalData.h +++ b/gr-qtgui/include/gnuradio/qtgui/waterfallGlobalData.h @@ -15,8 +15,9 @@ #include #if QWT_VERSION >= 0x060000 -#include -#include // doesn't seem necessary, but is... +#include + +typedef QwtInterval QwtDoubleInterval; #endif class WaterfallData : public QwtRasterData @@ -36,6 +37,9 @@ class WaterfallData : public QwtRasterData #if QWT_VERSION < 0x060000 virtual QwtDoubleInterval range() const; virtual void setRange(const QwtDoubleInterval&); +#else + virtual QwtInterval interval(Qt::Axis) const; + void setInterval(Qt::Axis, const QwtInterval&); #endif double value(double x, double y) const override; @@ -60,6 +64,7 @@ class WaterfallData : public QwtRasterData QwtDoubleInterval _intensityRange; #else QwtInterval _intensityRange; + QwtInterval d_intervals[3]; #endif private: diff --git a/gr-qtgui/lib/ConstellationDisplayPlot.cc b/gr-qtgui/lib/ConstellationDisplayPlot.cc index ffd3ecf5943..4283fad40f9 100644 --- a/gr-qtgui/lib/ConstellationDisplayPlot.cc +++ b/gr-qtgui/lib/ConstellationDisplayPlot.cc @@ -16,6 +16,7 @@ #include #include #include +#include class ConstellationDisplayZoomer : public QwtPlotZoomer { diff --git a/gr-qtgui/lib/plot_raster.cc b/gr-qtgui/lib/plot_raster.cc index 7bb439881a4..d79def0f44a 100644 --- a/gr-qtgui/lib/plot_raster.cc +++ b/gr-qtgui/lib/plot_raster.cc @@ -244,7 +244,11 @@ QImage PlotTimeRaster::renderImage(const QwtScaleMap& xMap, } d_data->data->incrementResidual(); } else if (d_data->colorMap->format() == QwtColorMap::Indexed) { +#if QWT_VERSION >= 0x060200 + image.setColorTable(d_data->colorMap->colorTable(256)); +#else image.setColorTable(d_data->colorMap->colorTable(intensityRange)); +#endif for (int y = rect.top(); y <= rect.bottom(); y++) { const double ty = yyMap.invTransform(y); @@ -253,8 +257,13 @@ QImage PlotTimeRaster::renderImage(const QwtScaleMap& xMap, for (int x = rect.left(); x <= rect.right(); x++) { const double tx = xxMap.invTransform(x); +#if QWT_VERSION >= 0x060200 + *line++ = d_data->colorMap->colorIndex( + 256, intensityRange, d_data->data->value(tx, ty)); +#else *line++ = d_data->colorMap->colorIndex(intensityRange, d_data->data->value(tx, ty)); +#endif } } } diff --git a/gr-qtgui/lib/plot_waterfall.cc b/gr-qtgui/lib/plot_waterfall.cc index ff47ea20032..94c44051d6d 100644 --- a/gr-qtgui/lib/plot_waterfall.cc +++ b/gr-qtgui/lib/plot_waterfall.cc @@ -240,7 +240,11 @@ QImage PlotWaterfall::renderImage(const QwtScaleMap& xMap, } } } else if (d_data->colorMap->format() == QwtColorMap::Indexed) { +#if QWT_VERSION >= 0x060200 + image.setColorTable(d_data->colorMap->colorTable(256)); +#else image.setColorTable(d_data->colorMap->colorTable(intensityRange)); +#endif for (int y = rect.top(); y <= rect.bottom(); y++) { const double ty = yyMap.invTransform(y); @@ -249,8 +253,13 @@ QImage PlotWaterfall::renderImage(const QwtScaleMap& xMap, for (int x = rect.left(); x <= rect.right(); x++) { const double tx = xxMap.invTransform(x); +#if QWT_VERSION >= 0x060200 + *line++ = d_data->colorMap->colorIndex( + 256, intensityRange, d_data->data->value(tx, ty)); +#else *line++ = d_data->colorMap->colorIndex(intensityRange, d_data->data->value(tx, ty)); +#endif } } } diff --git a/gr-qtgui/lib/timeRasterGlobalData.cc b/gr-qtgui/lib/timeRasterGlobalData.cc index 1b9e7a0332d..4ec028ffb3a 100644 --- a/gr-qtgui/lib/timeRasterGlobalData.cc +++ b/gr-qtgui/lib/timeRasterGlobalData.cc @@ -132,6 +132,13 @@ void TimeRasterData::setRange(const QwtDoubleInterval& newRange) { d_intensityRange = newRange; } +#else +void TimeRasterData::setInterval(Qt::Axis axis, const QwtInterval& interval) +{ + d_intervals[axis] = interval; +} + +QwtInterval TimeRasterData::interval(Qt::Axis a) const { return d_intervals[a]; } #endif diff --git a/gr-qtgui/lib/waterfallGlobalData.cc b/gr-qtgui/lib/waterfallGlobalData.cc index 4c703310475..38c955f2ee7 100644 --- a/gr-qtgui/lib/waterfallGlobalData.cc +++ b/gr-qtgui/lib/waterfallGlobalData.cc @@ -139,7 +139,13 @@ void WaterfallData::setRange(const QwtDoubleInterval& newRange) { _intensityRange = newRange; } +#else +void WaterfallData::setInterval(Qt::Axis axis, const QwtInterval& interval) +{ + d_intervals[axis] = interval; +} +QwtInterval WaterfallData::interval(Qt::Axis a) const { return d_intervals[a]; } #endif