22 #ifndef PLASMA_SIGNALPLOTTER_H
23 #define PLASMA_SIGNALPLOTTER_H
25 #include <QtGui/QFont>
26 #include <QtGui/QGraphicsWidget>
32 class SignalPlotterPrivate;
48 Q_PROPERTY(
QString title READ title WRITE setTitle)
49 Q_PROPERTY(
QString unit READ unit WRITE setUnit)
50 Q_PROPERTY(qreal scale READ scaledBy WRITE scale)
51 Q_PROPERTY(
bool useAutoRange READ useAutoRange WRITE setUseAutoRange)
52 Q_PROPERTY(uint horizontalScale READ horizontalScale WRITE setHorizontalScale)
53 Q_PROPERTY(
bool showVerticalLines READ showVerticalLines WRITE setShowVerticalLines)
54 Q_PROPERTY(
QColor verticalLinesColor READ verticalLinesColor WRITE setVerticalLinesColor)
55 Q_PROPERTY(uint verticalLinesDistance READ verticalLinesDistance WRITE setVerticalLinesDistance)
56 Q_PROPERTY(
bool verticalLinesScroll READ verticalLinesScroll WRITE setVerticalLinesScroll)
57 Q_PROPERTY(
bool showHorizontalLines READ showHorizontalLines WRITE setShowHorizontalLines)
58 Q_PROPERTY(
QColor horizontalLinesColor READ horizontalLinesColor WRITE setHorizontalLinesColor)
59 Q_PROPERTY(
QColor fontColor READ fontColor WRITE setFontColor)
60 Q_PROPERTY(
QFont font READ font WRITE setFont)
61 Q_PROPERTY(uint horizontalLinesCount READ horizontalLinesCount WRITE setHorizontalLinesCount)
62 Q_PROPERTY(
bool showLabels READ showLabels WRITE setShowLabels)
63 Q_PROPERTY(
bool showTopBar READ showTopBar WRITE setShowTopBar)
64 Q_PROPERTY(
QColor backgroundColor READ backgroundColor WRITE setBackgroundColor)
65 Q_PROPERTY(
QString svgBackground READ svgBackground WRITE setSvgBackground)
66 Q_PROPERTY(
bool thinFrame READ thinFrame WRITE setThinFrame)
67 Q_PROPERTY(
bool stackPlots READ stackPlots WRITE setStackPlots)
79 Q_INVOKABLE
void addPlot(const
QColor &color);
87 Q_INVOKABLE
void addSample(const
QList<
double> &samples);
102 Q_INVOKABLE
void reorderPlots(const
QList<uint>& newOrder);
108 Q_INVOKABLE
void removePlot(uint pos);
121 void setTitle(const
QString &title);
134 void setUnit(const
QString &unit);
149 void scale(qreal delta);
155 qreal scaledBy() const;
163 void setUseAutoRange(
bool value);
170 bool useAutoRange() const;
185 void setVerticalRange(
double min,
double max);
191 double verticalMinValue() const;
197 double verticalMaxValue() const;
203 void setHorizontalScale(uint scale);
209 uint horizontalScale() const;
215 void setShowVerticalLines(
bool value);
221 bool showVerticalLines() const;
227 void setVerticalLinesColor(const
QColor &color);
233 QColor verticalLinesColor() const;
239 void setVerticalLinesDistance(uint distance);
245 uint verticalLinesDistance() const;
251 void setVerticalLinesScroll(
bool value);
257 bool verticalLinesScroll() const;
263 void setShowHorizontalLines(
bool value);
268 bool showHorizontalLines() const;
274 void setHorizontalLinesColor(const
QColor &color);
280 QColor horizontalLinesColor() const;
286 void setFontColor(const
QColor &color);
298 void setFont(const
QFont &font);
311 void setHorizontalLinesCount(uint count);
318 uint horizontalLinesCount() const;
324 void setShowLabels(
bool value);
330 bool showLabels() const;
337 void setShowTopBar(
bool value);
344 bool showTopBar() const;
351 void setBackgroundColor(const
QColor &color);
358 QColor backgroundColor() const;
365 void setSvgBackground(const
QString &filename);
379 double lastValue(uint i) const;
386 QString lastValueAsString(uint i) const;
393 void setThinFrame(
bool set);
400 bool thinFrame() const;
408 void setStackPlots(
bool stack);
414 bool stackPlots() const;
424 QPixmap getSnapshotImage(uint width, uint height);
430 virtual
void setGeometry(const
QRectF &geometry);
433 void updateDataBuffers();
434 void calculateNiceRange();
438 void drawWidget(
QPainter *p, uint w, uint height,
int horizontalScale);
439 void drawBackground(
QPainter *p,
int w,
int h);
440 void drawThinFrame(
QPainter *p,
int w,
int h);
441 void drawTopBarFrame(
QPainter *p,
int separatorX,
int height);
442 void drawTopBarContents(
QPainter *p,
int x,
int width,
int height);
443 void drawVerticalLines(
QPainter *p,
int top,
int w,
int h);
444 void drawPlots(
QPainter *p,
int top,
int w,
int h,
int horizontalScale);
445 void drawAxisText(
QPainter *p,
int top,
int h);
446 void drawHorizontalLines(
QPainter *p,
int top,
int w,
int h);
449 SignalPlotterPrivate *const d;
450 Q_PRIVATE_SLOT(d,
void themeChanged())
Provides a signal plotter for plasma.