From 350611ddd9295ba8af6ea5913630ec0670208b43 Mon Sep 17 00:00:00 2001
From: Tom Rondeau <trondeau@vt.edu>
Date: Sat, 23 Apr 2011 23:56:52 -0400
Subject: gr-qtgui: multiple connections working, each with their own color.

---
 gr-qtgui/lib/TimeDomainDisplayPlot.cc | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

(limited to 'gr-qtgui/lib/TimeDomainDisplayPlot.cc')

diff --git a/gr-qtgui/lib/TimeDomainDisplayPlot.cc b/gr-qtgui/lib/TimeDomainDisplayPlot.cc
index e3c773e4cd..70b11dd0ee 100644
--- a/gr-qtgui/lib/TimeDomainDisplayPlot.cc
+++ b/gr-qtgui/lib/TimeDomainDisplayPlot.cc
@@ -27,6 +27,7 @@
 
 #include <qwt_scale_draw.h>
 #include <qwt_legend.h>
+#include <QColor>
 #include <iostream>
 
 class TimePrecisionClass
@@ -122,7 +123,16 @@ TimeDomainDisplayPlot::TimeDomainDisplayPlot(int nplots, QWidget* parent)
   setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine);
   set_yaxis(-2.0, 2.0);
   setAxisTitle(QwtPlot::yLeft, "Normalized Voltage");
-
+  
+  //QColor clr(Qt::blue);
+  QList<QColor> colors;
+  colors << QColor(Qt::blue) << QColor(Qt::red) << QColor(Qt::green)
+	 << QColor(Qt::black) << QColor(Qt::cyan) << QColor(Qt::magenta)
+	 << QColor(Qt::yellow) << QColor(Qt::gray) << QColor(Qt::darkRed)
+	 << QColor(Qt::darkGreen) << QColor(Qt::darkBlue) << QColor(Qt::darkGray);
+
+  int ncolors = colors.size();
+  
   // Setup dataPoints and plot vectors
   // Automatically deleted when parent is deleted
   for(int i = 0; i < _nplots; i++) {
@@ -131,10 +141,7 @@ TimeDomainDisplayPlot::TimeDomainDisplayPlot(int nplots, QWidget* parent)
 
     _plot_curve.push_back(new QwtPlotCurve(QString("Data %1").arg(i)));
     _plot_curve[i]->attach(this);
-    if(i == 0)
-      _plot_curve[i]->setPen(QPen(Qt::blue));
-    else
-      _plot_curve[i]->setPen(QPen(Qt::red));
+    _plot_curve[i]->setPen(QPen(colors[i]));
     _plot_curve[i]->setRawData(_xAxisPoints, _dataPoints[i], _numPoints);
   }
 
-- 
cgit v1.2.3