summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2015-05-10 19:57:47 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2015-05-10 19:57:47 -0700
commitf63a83ae0baa84a5523d0c5c5a8ab9ef37618d88 (patch)
treecf7f0021b9f0478e864284773ca4f15f5dffe050
parentd4c1eb1bb85ba5f34dfa8583b9a0bfdfdd7bbc79 (diff)
parentfc2b254ac8b758ee7a8db3ecf69ad18cff7ecf8f (diff)
Merge remote-tracking branch 'tom/qtgui/qss_tag_colors' into maint
-rw-r--r--gr-qtgui/include/gnuradio/qtgui/TimeDomainDisplayPlot.h16
-rw-r--r--gr-qtgui/lib/TimeDomainDisplayPlot.cc50
-rw-r--r--gr-qtgui/themes/alt.qss6
-rw-r--r--gr-qtgui/themes/dark.qss8
4 files changed, 77 insertions, 3 deletions
diff --git a/gr-qtgui/include/gnuradio/qtgui/TimeDomainDisplayPlot.h b/gr-qtgui/include/gnuradio/qtgui/TimeDomainDisplayPlot.h
index 4b743e0b92..47fc0b3c69 100644
--- a/gr-qtgui/include/gnuradio/qtgui/TimeDomainDisplayPlot.h
+++ b/gr-qtgui/include/gnuradio/qtgui/TimeDomainDisplayPlot.h
@@ -37,6 +37,10 @@ class TimeDomainDisplayPlot: public DisplayPlot
{
Q_OBJECT
+ Q_PROPERTY ( QColor tag_text_color READ getTagTextColor WRITE setTagTextColor )
+ Q_PROPERTY ( QColor tag_background_color READ getTagBackgroundColor WRITE setTagBackgroundColor )
+ Q_PROPERTY ( Qt::BrushStyle tag_background_style READ getTagBackgroundStyle WRITE setTagBackgroundStyle )
+
public:
TimeDomainDisplayPlot(int nplots, QWidget*);
virtual ~TimeDomainDisplayPlot();
@@ -52,6 +56,10 @@ public:
double sampleRate() const;
+ const QColor getTagTextColor();
+ const QColor getTagBackgroundColor();
+ const Qt::BrushStyle getTagBackgroundStyle();
+
public slots:
void setSampleRate(double sr, double units,
const std::string &strunits);
@@ -72,6 +80,10 @@ public slots:
void attachTriggerLines(bool en);
void setTriggerLines(double x, double y);
+ void setTagTextColor(QColor c);
+ void setTagBackgroundColor(QColor c);
+ void setTagBackgroundStyle(Qt::BrushStyle b);
+
private:
void _resetXAxisPoints();
void _autoScale(double bottom, double top);
@@ -88,6 +100,10 @@ private:
std::vector< std::vector<QwtPlotMarker*> > d_tag_markers;
std::vector<bool> d_tag_markers_en;
+ QColor d_tag_text_color;
+ QColor d_tag_background_color;
+ Qt::BrushStyle d_tag_background_style;
+
QwtPlotMarker *d_trigger_lines[2];
};
diff --git a/gr-qtgui/lib/TimeDomainDisplayPlot.cc b/gr-qtgui/lib/TimeDomainDisplayPlot.cc
index 16ba4a39c6..bc9f630235 100644
--- a/gr-qtgui/lib/TimeDomainDisplayPlot.cc
+++ b/gr-qtgui/lib/TimeDomainDisplayPlot.cc
@@ -135,6 +135,10 @@ TimeDomainDisplayPlot::TimeDomainDisplayPlot(int nplots, QWidget* parent)
d_xdata = new double[d_numPoints];
memset(d_xdata, 0x0, d_numPoints*sizeof(double));
+ d_tag_text_color = Qt::black;
+ d_tag_background_color = Qt::white;
+ d_tag_background_style = Qt::NoBrush;
+
d_zoomer = new TimeDomainDisplayZoomer(canvas(), 0);
#if QWT_VERSION < 0x060000
@@ -381,7 +385,14 @@ TimeDomainDisplayPlot::plotNewData(const std::vector<double*> dataPoints,
QString orig = (*mitr)->label().text();
s << std::endl;
orig.prepend(s.str().c_str());
- (*mitr)->setLabel(orig);
+
+ QwtText newtext(orig);
+ newtext.setColor(getTagTextColor());
+
+ QBrush brush(getTagBackgroundColor(), getTagBackgroundStyle());
+ newtext.setBackgroundBrush(brush);
+
+ (*mitr)->setLabel(newtext);
}
}
@@ -598,6 +609,43 @@ TimeDomainDisplayPlot::enableTagMarker(int which, bool en)
throw std::runtime_error("TimeDomainDisplayPlot: enabled tag marker does not exist.\n");
}
+const QColor
+TimeDomainDisplayPlot::getTagTextColor()
+{
+ return d_tag_text_color;
+}
+
+const QColor
+TimeDomainDisplayPlot::getTagBackgroundColor()
+{
+ return d_tag_background_color;
+}
+
+const Qt::BrushStyle
+TimeDomainDisplayPlot::getTagBackgroundStyle()
+{
+ return d_tag_background_style;
+}
+
+void
+TimeDomainDisplayPlot::setTagTextColor(QColor c)
+{
+ d_tag_text_color = c;
+}
+
+void
+TimeDomainDisplayPlot::setTagBackgroundColor(QColor c)
+{
+ d_tag_background_color = c;
+}
+
+void
+TimeDomainDisplayPlot::setTagBackgroundStyle(Qt::BrushStyle b)
+{
+ d_tag_background_style = b;
+}
+
+
void
TimeDomainDisplayPlot::setYLabel(const std::string &label,
const std::string &unit)
diff --git a/gr-qtgui/themes/alt.qss b/gr-qtgui/themes/alt.qss
index 29bec19157..fb15df3f5a 100644
--- a/gr-qtgui/themes/alt.qss
+++ b/gr-qtgui/themes/alt.qss
@@ -27,6 +27,12 @@ DisplayPlot {
qproperty-axes_label_font_size: 18;
}
+TimeDomainDisplayPlot {
+ qproperty-tag_text_color: blue;
+ qproperty-tag_background_color: grey;
+ qproperty-tag_background_style: Dense4Pattern;
+}
+
WaterfallDisplayPlot {
qproperty-intensity_color_map_type1: 5;
qproperty-low_intensity_color: black;
diff --git a/gr-qtgui/themes/dark.qss b/gr-qtgui/themes/dark.qss
index 8999bdae72..5b236fa3aa 100644
--- a/gr-qtgui/themes/dark.qss
+++ b/gr-qtgui/themes/dark.qss
@@ -21,6 +21,12 @@ DisplayPlot {
qproperty-axes_label_font_size: 18;
}
+TimeDomainDisplayPlot {
+ qproperty-tag_text_color: blue;
+ qproperty-tag_background_color: grey;
+ qproperty-tag_background_style: Dense4Pattern;
+}
+
WaterfallDisplayPlot {
qproperty-intensity_color_map_type1: 1;
qproperty-low_intensity_color: black;
@@ -122,5 +128,3 @@ QTabBar::tab:selected {
background-color: rgb(200, 200, 200);
color: black;
}
-
-