From 25fd6e0324dc8296b66a3c9b8e628d6738f15fe7 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sat, 15 Oct 2011 18:23:04 -0400 Subject: qtgui: wip: updating qtgui to work with QWT 6 (and trying to maintain backwards compatability to 5.2). This wip works for just the fft plots. --- gr-qtgui/lib/ConstellationDisplayPlot.cc | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'gr-qtgui/lib/ConstellationDisplayPlot.cc') diff --git a/gr-qtgui/lib/ConstellationDisplayPlot.cc b/gr-qtgui/lib/ConstellationDisplayPlot.cc index dda7cfea2..a9c64d274 100644 --- a/gr-qtgui/lib/ConstellationDisplayPlot.cc +++ b/gr-qtgui/lib/ConstellationDisplayPlot.cc @@ -68,11 +68,17 @@ ConstellationDisplayPlot::ConstellationDisplayPlot(QWidget* parent) _imagDataPoints = new double[_numPoints]; // Disable polygon clipping +#if QWT_VERSION < 0x060000 QwtPainter::setDeviceClipping(false); +#else + QwtPainter::setPolylineSplitting(false); +#endif +#if QWT_VERSION < 0x060000 // We don't need the cache here canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, false); canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false); +#endif QPalette palette; palette.setColor(canvas()->backgroundRole(), QColor("white")); @@ -91,13 +97,22 @@ ConstellationDisplayPlot::ConstellationDisplayPlot(QWidget* parent) _plot_curve->attach(this); _plot_curve->setPen(QPen(Qt::blue, _penSize, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); _plot_curve->setStyle(QwtPlotCurve::Dots); + +#if QWT_VERSION < 0x060000 _plot_curve->setRawData(_realDataPoints, _imagDataPoints, _numPoints); +#else + _plot_curve->setRawSamples(_realDataPoints, _imagDataPoints, _numPoints); +#endif memset(_realDataPoints, 0x0, _numPoints*sizeof(double)); memset(_imagDataPoints, 0x0, _numPoints*sizeof(double)); _zoomer = new ConstellationDisplayZoomer(canvas()); + +#if QWT_VERSION < 0x060000 _zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection); +#endif + _zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier); _zoomer->setMousePattern(QwtEventPattern::MouseSelect3, @@ -120,9 +135,8 @@ ConstellationDisplayPlot::ConstellationDisplayPlot(QWidget* parent) // emit the position of clicks on widget _picker = new QwtDblClickPlotPicker(canvas()); - connect(_picker, SIGNAL(selected(const QwtDoublePoint &)), - this, SLOT(OnPickerPointSelected(const QwtDoublePoint &))); - + connect(_picker, SIGNAL(selected(const QPointF &)), + this, SLOT(OnPickerPointSelected(const QPointF &))); connect(this, SIGNAL(legendChecked(QwtPlotItem *, bool ) ), this, SLOT(LegendEntryChecked(QwtPlotItem *, bool ) )); } @@ -193,7 +207,11 @@ void ConstellationDisplayPlot::PlotNewData(const double* realDataPoints, _realDataPoints = new double[_numPoints]; _imagDataPoints = new double[_numPoints]; +#if QWT_VERSION < 0x060000 _plot_curve->setRawData(_realDataPoints, _imagDataPoints, _numPoints); +#else + _plot_curve->setRawSamples(_realDataPoints, _imagDataPoints, _numPoints); +#endif } memcpy(_realDataPoints, realDataPoints, numDataPoints*sizeof(double)); @@ -210,7 +228,7 @@ ConstellationDisplayPlot::LegendEntryChecked(QwtPlotItem* plotItem, bool on) } void -ConstellationDisplayPlot::OnPickerPointSelected(const QwtDoublePoint & p) +ConstellationDisplayPlot::OnPickerPointSelected(const QPointF & p) { QPointF point = p; //fprintf(stderr,"OnPickerPointSelected %f %f\n", point.x(), point.y()); -- cgit From 4ba2c75f9109b750f8c04b60a04f2100e33e9416 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 16 Oct 2011 00:23:32 -0400 Subject: qtgui: constellation plot working again under qwt6. --- gr-qtgui/lib/ConstellationDisplayPlot.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gr-qtgui/lib/ConstellationDisplayPlot.cc') diff --git a/gr-qtgui/lib/ConstellationDisplayPlot.cc b/gr-qtgui/lib/ConstellationDisplayPlot.cc index a9c64d274..e01c99b74 100644 --- a/gr-qtgui/lib/ConstellationDisplayPlot.cc +++ b/gr-qtgui/lib/ConstellationDisplayPlot.cc @@ -217,6 +217,8 @@ void ConstellationDisplayPlot::PlotNewData(const double* realDataPoints, memcpy(_realDataPoints, realDataPoints, numDataPoints*sizeof(double)); memcpy(_imagDataPoints, imagDataPoints, numDataPoints*sizeof(double)); + replot(); + _lastReplot = gruel::high_res_timer_now(); } } -- cgit From 45c2212608ca66b5fadbc860771e042198e1ebcd Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 16 Oct 2011 19:45:29 -0400 Subject: qtgui: more compatability issues. --- gr-qtgui/lib/ConstellationDisplayPlot.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'gr-qtgui/lib/ConstellationDisplayPlot.cc') diff --git a/gr-qtgui/lib/ConstellationDisplayPlot.cc b/gr-qtgui/lib/ConstellationDisplayPlot.cc index e01c99b74..ca7eede36 100644 --- a/gr-qtgui/lib/ConstellationDisplayPlot.cc +++ b/gr-qtgui/lib/ConstellationDisplayPlot.cc @@ -135,8 +135,15 @@ ConstellationDisplayPlot::ConstellationDisplayPlot(QWidget* parent) // emit the position of clicks on widget _picker = new QwtDblClickPlotPicker(canvas()); + +#if QWT_VERSION < 0x060000 + connect(_picker, SIGNAL(selected(const QwtDoublePoint &)), + this, SLOT(OnPickerPointSelected(const QwtDoublePoint &))); +#else connect(_picker, SIGNAL(selected(const QPointF &)), this, SLOT(OnPickerPointSelected(const QPointF &))); +#endif + connect(this, SIGNAL(legendChecked(QwtPlotItem *, bool ) ), this, SLOT(LegendEntryChecked(QwtPlotItem *, bool ) )); } @@ -229,6 +236,15 @@ ConstellationDisplayPlot::LegendEntryChecked(QwtPlotItem* plotItem, bool on) plotItem->setVisible(!on); } +#if QWT_VERSION < 0x060000 +void +ConstellationDisplayPlot::OnPickerPointSelected(const QwtDoublePoint & p) +{ + QPointF point = p; + //fprintf(stderr,"OnPickerPointSelected %f %f\n", point.x(), point.y()); + emit plotPointSelected(point); +} +#else void ConstellationDisplayPlot::OnPickerPointSelected(const QPointF & p) { @@ -236,5 +252,6 @@ ConstellationDisplayPlot::OnPickerPointSelected(const QPointF & p) //fprintf(stderr,"OnPickerPointSelected %f %f\n", point.x(), point.y()); emit plotPointSelected(point); } +#endif #endif /* CONSTELLATION_DISPLAY_PLOT_C */ -- cgit