diff options
author | Tom Rondeau | 2011-04-24 01:47:05 -0400 |
---|---|---|
committer | Tom Rondeau | 2011-04-24 01:47:05 -0400 |
commit | 11de76b9214a59930ac8d8c031880b5bd293973d (patch) | |
tree | 53dac76c223788a8b225cd504f59811eef49ae64 /gr-qtgui | |
parent | 43a3a7296412dc52216e7f63856a86945f4ba438 (diff) | |
download | gnuradio-11de76b9214a59930ac8d8c031880b5bd293973d.tar.gz gnuradio-11de76b9214a59930ac8d8c031880b5bd293973d.tar.bz2 gnuradio-11de76b9214a59930ac8d8c031880b5bd293973d.zip |
gr-qtgui: adding function and slot to set a time display curve's color.
Diffstat (limited to 'gr-qtgui')
-rw-r--r-- | gr-qtgui/lib/TimeDomainDisplayPlot.cc | 9 | ||||
-rw-r--r-- | gr-qtgui/lib/TimeDomainDisplayPlot.h | 1 | ||||
-rw-r--r-- | gr-qtgui/lib/qtgui_time_sink_c.cc | 6 | ||||
-rw-r--r-- | gr-qtgui/lib/qtgui_time_sink_c.h | 1 | ||||
-rw-r--r-- | gr-qtgui/lib/timedisplayform.cc | 6 | ||||
-rw-r--r-- | gr-qtgui/lib/timedisplayform.h | 1 | ||||
-rw-r--r-- | gr-qtgui/swig/qtgui_time_sink_c.i | 1 |
7 files changed, 24 insertions, 1 deletions
diff --git a/gr-qtgui/lib/TimeDomainDisplayPlot.cc b/gr-qtgui/lib/TimeDomainDisplayPlot.cc index ee13a7dce..f635a2b0c 100644 --- a/gr-qtgui/lib/TimeDomainDisplayPlot.cc +++ b/gr-qtgui/lib/TimeDomainDisplayPlot.cc @@ -213,6 +213,12 @@ TimeDomainDisplayPlot::setTitle(int which, QString title) _plot_curve[which]->setTitle(title); } +void +TimeDomainDisplayPlot::setColor(int which, QString color) +{ + _plot_curve[which]->setPen(QPen(color)); +} + void TimeDomainDisplayPlot::replot() { QwtPlot::replot(); @@ -221,7 +227,8 @@ void TimeDomainDisplayPlot::replot() void TimeDomainDisplayPlot::resizeSlot( QSize *s ) { - resize(s->width(), s->height()); + // -10 is to spare some room for the legend and x-axis label + resize(s->width()-10, s->height()-10); } void TimeDomainDisplayPlot::PlotNewData(const std::vector<double*> dataPoints, diff --git a/gr-qtgui/lib/TimeDomainDisplayPlot.h b/gr-qtgui/lib/TimeDomainDisplayPlot.h index 1693e7537..4c7b1e319 100644 --- a/gr-qtgui/lib/TimeDomainDisplayPlot.h +++ b/gr-qtgui/lib/TimeDomainDisplayPlot.h @@ -56,6 +56,7 @@ public slots: void setYaxis(double min, double max); void setXaxis(double min, double max); void setTitle(int which, QString title); + void setColor(int which, QString color); void resizeSlot( QSize *s ); void SetSampleRate(double sr, double units, diff --git a/gr-qtgui/lib/qtgui_time_sink_c.cc b/gr-qtgui/lib/qtgui_time_sink_c.cc index e57ef011a..a1f0130ba 100644 --- a/gr-qtgui/lib/qtgui_time_sink_c.cc +++ b/gr-qtgui/lib/qtgui_time_sink_c.cc @@ -136,6 +136,12 @@ qtgui_time_sink_c::set_title(int which, const std::string &title) d_main_gui->SetTitle(which, title.c_str()); } +void +qtgui_time_sink_c::set_color(int which, const std::string &color) +{ + d_main_gui->SetColor(which, color.c_str()); +} + int qtgui_time_sink_c::general_work (int noutput_items, gr_vector_int &ninput_items, diff --git a/gr-qtgui/lib/qtgui_time_sink_c.h b/gr-qtgui/lib/qtgui_time_sink_c.h index 97c1d6e52..fd1637232 100644 --- a/gr-qtgui/lib/qtgui_time_sink_c.h +++ b/gr-qtgui/lib/qtgui_time_sink_c.h @@ -79,6 +79,7 @@ public: void set_time_domain_axis(double min, double max); void set_update_time(double t); void set_title(int which, const std::string &title); + void set_color(int which, const std::string &color); QApplication *d_qApplication; diff --git a/gr-qtgui/lib/timedisplayform.cc b/gr-qtgui/lib/timedisplayform.cc index 05baee7f9..c2bb9f75d 100644 --- a/gr-qtgui/lib/timedisplayform.cc +++ b/gr-qtgui/lib/timedisplayform.cc @@ -169,3 +169,9 @@ TimeDisplayForm::SetTitle(int which, QString title) { _timeDomainDisplayPlot->setTitle(which, title); } + +void +TimeDisplayForm::SetColor(int which, QString color) +{ + _timeDomainDisplayPlot->setColor(which, color); +} diff --git a/gr-qtgui/lib/timedisplayform.h b/gr-qtgui/lib/timedisplayform.h index db2d58db7..1e2ad601b 100644 --- a/gr-qtgui/lib/timedisplayform.h +++ b/gr-qtgui/lib/timedisplayform.h @@ -57,6 +57,7 @@ public slots: void SetUpdateTime(double t); void SetTitle(int which, QString title); + void SetColor(int which, QString color); private slots: void newData( const TimeUpdateEvent* ); diff --git a/gr-qtgui/swig/qtgui_time_sink_c.i b/gr-qtgui/swig/qtgui_time_sink_c.i index e5d4a91df..8f5c9f4f0 100644 --- a/gr-qtgui/swig/qtgui_time_sink_c.i +++ b/gr-qtgui/swig/qtgui_time_sink_c.i @@ -52,4 +52,5 @@ public: void set_time_domain_axis(double min, double max); void set_update_time(double t); void set_title(int which, const std::string &title); + void set_color(int which, const std::string &color); }; |