Profile: support grayscale plotting

This patch adds the getColor() helper function to
ProfileGraphicsView and EventItem so that retrieving
a certain color can depend on a 'isGrayscale' flag.
This flag is private and only set by
ProfileGraphicsView::setPrintMode() at this point.
EventItem also now accepts 'grayscale' as a constructor
argument.

A couple of side modifications are:
- move setBackgroundBrush() to ProfileGraphicsView::plot()
- set the same pen color as brush color for the dot in the
'!' symbol inside EventItem::EventItem().

TODO: look for color issues when printing using the
custom grayscale table

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
Lubomir I. Ivanov 2013-07-13 18:18:26 +03:00 committed by Dirk Hohndel
parent 17c97b921f
commit 9de15dec60
2 changed files with 54 additions and 38 deletions

View file

@ -1,6 +1,7 @@
#ifndef PROFILEGRAPHICS_H
#define PROFILEGRAPHICS_H
#include "graphicsview-common.h"
#include "../display.h"
#include <QGraphicsView>
#include <QGraphicsItem>
@ -60,12 +61,15 @@ private:
class EventItem : public QGraphicsPolygonItem
{
public:
explicit EventItem(QGraphicsItem* parent = 0);
explicit EventItem(QGraphicsItem* parent = 0, bool grayscale = FALSE);
private:
ToolTipItem *controller;
QString text;
QIcon icon;
bool isGrayscale;
QColor getColor(const color_indice_t i);
};
class GraphicsTextEditor : public QGraphicsTextItem{
@ -125,6 +129,7 @@ private:
void plot_pp_text();
void plot_depth_scale();
QColor getColor(const color_indice_t i);
QColor get_sac_color(int sac, int avg_sac);
void scrollViewTo(const QPoint pos);