Skip to content

Commit 14d30f1

Browse files
bmuzikamormj
authored andcommitted
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 <[email protected]>
1 parent f9a693d commit 14d30f1

13 files changed

+71
-11
lines changed

gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@
2929
#include <vector>
3030

3131
#if QWT_VERSION >= 0x060000
32-
#include <qwt_compat.h>
32+
typedef QPointF QwtDoublePoint;
33+
typedef QRectF QwtDoubleRect;
34+
35+
typedef QwtInterval QwtDoubleInterval;
3336
#endif
3437

3538
typedef QList<QColor> QColorList;

gr-qtgui/include/gnuradio/qtgui/TimeRasterDisplayPlot.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
#if QWT_VERSION < 0x060000
2424
#include <gnuradio/qtgui/plot_waterfall.h>
2525
#else
26-
#include <qwt_compat.h>
26+
#include <qwt_interval.h>
27+
28+
typedef QwtInterval QwtDoubleInterval;
2729
#endif
2830

2931
/*!

gr-qtgui/include/gnuradio/qtgui/WaterfallDisplayPlot.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
#if QWT_VERSION < 0x060000
2323
#include <gnuradio/qtgui/plot_waterfall.h>
2424
#else
25-
#include <qwt_compat.h>
25+
#include <qwt_interval.h>
26+
27+
typedef QwtInterval QwtDoubleInterval;
2628
#endif
2729

2830
/*!

gr-qtgui/include/gnuradio/qtgui/plot_raster.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
#include <qwt_plot_rasteritem.h>
1717

1818
#if QWT_VERSION >= 0x060000
19-
#include <qwt_compat.h>
20-
#include <qwt_point_3d.h> // doesn't seem necessary, but is...
19+
#include <qsize.h>
20+
#include <qwt_interval.h>
21+
22+
typedef QwtInterval QwtDoubleInterval;
2123
#endif
2224

2325
class QwtColorMap;

gr-qtgui/include/gnuradio/qtgui/plot_waterfall.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
#include <qwt_plot_rasteritem.h>
1717

1818
#if QWT_VERSION >= 0x060000
19-
#include <qwt_compat.h>
20-
#include <qwt_point_3d.h> // doesn't seem necessary, but is...
19+
#include <qsize.h>
20+
#include <qwt_interval.h>
21+
22+
typedef QwtInterval QwtDoubleInterval;
2123
#endif
2224

2325
class QwtColorMap;

gr-qtgui/include/gnuradio/qtgui/qtgui_types.h

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <gnuradio/high_res_timer.h>
1515
#include <qwt_color_map.h>
1616
#include <qwt_scale_draw.h>
17+
#include <qwt_text.h>
1718

1819
namespace gr {
1920
namespace qtgui {

gr-qtgui/include/gnuradio/qtgui/timeRasterGlobalData.h

+10-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
#include <cinttypes>
1616

1717
#if QWT_VERSION >= 0x060000
18-
#include <qwt_compat.h>
19-
#include <qwt_point_3d.h> // doesn't seem necessary, but is...
18+
#include <qwt_interval.h>
19+
20+
typedef QwtInterval QwtDoubleInterval;
2021
#endif
2122

2223
class TimeRasterData : public QwtRasterData
@@ -35,6 +36,9 @@ class TimeRasterData : public QwtRasterData
3536
#if QWT_VERSION < 0x060000
3637
virtual QwtDoubleInterval range() const;
3738
virtual void setRange(const QwtDoubleInterval&);
39+
#elif QWT_VERSION >= 0x060200
40+
virtual QwtInterval interval(Qt::Axis) const;
41+
void setInterval(Qt::Axis, const QwtInterval&);
3842
#endif
3943

4044
double value(double x, double y) const override;
@@ -58,6 +62,10 @@ class TimeRasterData : public QwtRasterData
5862
QwtInterval d_intensityRange;
5963
#endif
6064

65+
#if QWT_VERSION >= 0x060200
66+
QwtInterval d_intervals[3];
67+
#endif
68+
6169
private:
6270
};
6371

gr-qtgui/include/gnuradio/qtgui/waterfallGlobalData.h

+10-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
#include <cinttypes>
1616

1717
#if QWT_VERSION >= 0x060000
18-
#include <qwt_compat.h>
19-
#include <qwt_point_3d.h> // doesn't seem necessary, but is...
18+
#include <qwt_interval.h>
19+
20+
typedef QwtInterval QwtDoubleInterval;
2021
#endif
2122

2223
class WaterfallData : public QwtRasterData
@@ -36,6 +37,9 @@ class WaterfallData : public QwtRasterData
3637
#if QWT_VERSION < 0x060000
3738
virtual QwtDoubleInterval range() const;
3839
virtual void setRange(const QwtDoubleInterval&);
40+
#elif QWT_VERSION >= 0x060200
41+
virtual QwtInterval interval(Qt::Axis) const;
42+
void setInterval(Qt::Axis, const QwtInterval&);
3943
#endif
4044

4145
double value(double x, double y) const override;
@@ -62,6 +66,10 @@ class WaterfallData : public QwtRasterData
6266
QwtInterval _intensityRange;
6367
#endif
6468

69+
#if QWT_VERSION >= 0x060200
70+
QwtInterval d_intervals[3];
71+
#endif
72+
6573
private:
6674
};
6775

gr-qtgui/lib/ConstellationDisplayPlot.cc

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <qwt_legend.h>
1717
#include <qwt_scale_draw.h>
1818
#include <QColor>
19+
#include <cmath>
1920

2021
class ConstellationDisplayZoomer : public QwtPlotZoomer
2122
{

gr-qtgui/lib/plot_raster.cc

+9
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,11 @@ QImage PlotTimeRaster::renderImage(const QwtScaleMap& xMap,
244244
}
245245
d_data->data->incrementResidual();
246246
} else if (d_data->colorMap->format() == QwtColorMap::Indexed) {
247+
#if QWT_VERSION >= 0x060200
248+
image.setColorTable(d_data->colorMap->colorTable(256));
249+
#else
247250
image.setColorTable(d_data->colorMap->colorTable(intensityRange));
251+
#endif
248252

249253
for (int y = rect.top(); y <= rect.bottom(); y++) {
250254
const double ty = yyMap.invTransform(y);
@@ -253,8 +257,13 @@ QImage PlotTimeRaster::renderImage(const QwtScaleMap& xMap,
253257
for (int x = rect.left(); x <= rect.right(); x++) {
254258
const double tx = xxMap.invTransform(x);
255259

260+
#if QWT_VERSION >= 0x060200
261+
*line++ = d_data->colorMap->colorIndex(
262+
256, intensityRange, d_data->data->value(tx, ty));
263+
#else
256264
*line++ = d_data->colorMap->colorIndex(intensityRange,
257265
d_data->data->value(tx, ty));
266+
#endif
258267
}
259268
}
260269
}

gr-qtgui/lib/plot_waterfall.cc

+9
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,11 @@ QImage PlotWaterfall::renderImage(const QwtScaleMap& xMap,
240240
}
241241
}
242242
} else if (d_data->colorMap->format() == QwtColorMap::Indexed) {
243+
#if QWT_VERSION >= 0x060200
244+
image.setColorTable(d_data->colorMap->colorTable(256));
245+
#else
243246
image.setColorTable(d_data->colorMap->colorTable(intensityRange));
247+
#endif
244248

245249
for (int y = rect.top(); y <= rect.bottom(); y++) {
246250
const double ty = yyMap.invTransform(y);
@@ -249,8 +253,13 @@ QImage PlotWaterfall::renderImage(const QwtScaleMap& xMap,
249253
for (int x = rect.left(); x <= rect.right(); x++) {
250254
const double tx = xxMap.invTransform(x);
251255

256+
#if QWT_VERSION >= 0x060200
257+
*line++ = d_data->colorMap->colorIndex(
258+
256, intensityRange, d_data->data->value(tx, ty));
259+
#else
252260
*line++ = d_data->colorMap->colorIndex(intensityRange,
253261
d_data->data->value(tx, ty));
262+
#endif
254263
}
255264
}
256265
}

gr-qtgui/lib/timeRasterGlobalData.cc

+7
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,13 @@ void TimeRasterData::setRange(const QwtDoubleInterval& newRange)
132132
{
133133
d_intensityRange = newRange;
134134
}
135+
#elif QWT_VERSION >= 0x060200
136+
void TimeRasterData::setInterval(Qt::Axis axis, const QwtInterval& interval)
137+
{
138+
d_intervals[axis] = interval;
139+
}
140+
141+
QwtInterval TimeRasterData::interval(Qt::Axis a) const { return d_intervals[a]; }
135142

136143
#endif
137144

gr-qtgui/lib/waterfallGlobalData.cc

+6
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,13 @@ void WaterfallData::setRange(const QwtDoubleInterval& newRange)
139139
{
140140
_intensityRange = newRange;
141141
}
142+
#elif QWT_VERSION >= 0x060200
143+
void WaterfallData::setInterval(Qt::Axis axis, const QwtInterval& interval)
144+
{
145+
d_intervals[axis] = interval;
146+
}
142147

148+
QwtInterval WaterfallData::interval(Qt::Axis a) const { return d_intervals[a]; }
143149
#endif
144150

145151

0 commit comments

Comments
 (0)