diff options
author | Tom Rondeau <tom@trondeau.com> | 2013-12-17 19:22:03 -0500 |
---|---|---|
committer | Tom Rondeau <tom@trondeau.com> | 2013-12-18 23:45:37 -0500 |
commit | d16393700d1f286fb2c67ea53ddebaad151f4803 (patch) | |
tree | 3efb1de19a3ed0d21debe9067a194cf75072ca6d /gr-qtgui/lib/DisplayPlot.cc | |
parent | b3b8a1f4965f8283f2c3d22ae45b569b2fe6d713 (diff) |
qtgui: enables use of QWT 6.1.
Diffstat (limited to 'gr-qtgui/lib/DisplayPlot.cc')
-rw-r--r-- | gr-qtgui/lib/DisplayPlot.cc | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/gr-qtgui/lib/DisplayPlot.cc b/gr-qtgui/lib/DisplayPlot.cc index 5c29381906..6f1f106f25 100644 --- a/gr-qtgui/lib/DisplayPlot.cc +++ b/gr-qtgui/lib/DisplayPlot.cc @@ -27,6 +27,7 @@ #include <QColor> #include <cmath> #include <iostream> +#include <stdexcept> #include <QDebug> DisplayPlot::DisplayPlot(int nplots, QWidget* parent) @@ -81,11 +82,19 @@ DisplayPlot::DisplayPlot(int nplots, QWidget* parent) sd->setMinimumExtent( fm.width("100.00") ); QwtLegend* legendDisplay = new QwtLegend(this); + +#if QWT_VERSION < 0x060100 legendDisplay->setItemMode(QwtLegend::CheckableItem); insertLegend(legendDisplay); - connect(this, SIGNAL(legendChecked(QwtPlotItem *, bool)), this, SLOT(legendEntryChecked(QwtPlotItem *, bool))); +#else /* QWT_VERSION < 0x060100 */ + legendDisplay->setDefaultItemMode(QwtLegendData::Checkable); + insertLegend(legendDisplay); + connect(legendDisplay, SIGNAL(checked(const QVariant&, bool, int)), + this, SLOT(legendEntryChecked(const QVariant&, bool, int))); +#endif /* QWT_VERSION < 0x060100 */ + } DisplayPlot::~DisplayPlot() @@ -403,6 +412,16 @@ void DisplayPlot::legendEntryChecked(QwtPlotItem* plotItem, bool on) replot(); } +void DisplayPlot::legendEntryChecked(const QVariant &plotItem, bool on, int index) +{ +#if QWT_VERSION < 0x060100 + std::runtime_error("DisplayPlot::legendEntryChecked with QVariant not enabled in this version of QWT.\n"); +#else + QwtPlotItem *p = infoToItem(plotItem); + legendEntryChecked(p, on); +#endif /* QWT_VERSION < 0x060100 */ +} + void DisplayPlot::onPickerPointSelected(const QwtDoublePoint & p) { |