26 #include <QtCore/QList> 27 #include <QtCore/QMap> 29 #include <QtGui/QBrush> 30 #include <QGraphicsEllipseItem> 31 #include <QtCore/QMutex> 33 #include <QPushButton> 34 #include <QtCore/QTime> 51 UPlotItem(qreal dataX, qreal dataY, qreal width=2);
55 UPlotItem(
const QPointF & data, qreal width=2);
60 void setPreviousItem(
UPlotItem * previousItem);
61 void setData(
const QPointF & data);
65 const QPointF &
data()
const {
return _data;}
68 virtual void hoverEnterEvent(QGraphicsSceneHoverEvent * event);
69 virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent * event);
70 virtual void focusInEvent(QFocusEvent * event);
71 virtual void focusOutEvent(QFocusEvent * event);
72 virtual void keyReleaseEvent(QKeyEvent * keyEvent);
74 virtual void showDescription(
bool shown);
76 void init(qreal dataX, qreal dataY);
99 UPlotCurve(
const QString & name, QObject * parent = 0);
103 UPlotCurve(
const QString & name,
const QVector<UPlotItem *> data, QObject * parent = 0);
107 UPlotCurve(
const QString & name,
const QVector<float> & x,
const QVector<float> & y, QObject * parent = 0);
113 const QPen &
pen()
const {
return _pen;}
117 const QBrush &
brush()
const {
return _brush;}
122 void setPen(
const QPen & pen);
126 void setBrush(
const QBrush & brush);
128 void setItemsColor(
const QColor & color);
134 QString
name()
const {
return _name;}
138 int itemsSize()
const;
139 QPointF getItemData(
int index);
141 void setData(QVector<UPlotItem*> & data);
142 void getData(QVector<float> & x, QVector<float> & y)
const;
143 void getData(QMap<float,float> & data)
const;
144 void draw(QPainter * painter,
const QRect & limits);
151 virtual void clear();
156 void setVisible(
bool visible);
161 void setXIncrement(
float increment);
166 void setXStart(
float val);
195 void addValues(QVector<UPlotItem *> & data);
200 void addValues(
const QVector<float> & xs,
const QVector<float> & ys);
206 void addValues(
const QVector<float> & ys);
207 void addValues(
const QVector<int> & ys);
213 void addValues(
const std::vector<float> & ys);
214 void addValues(
const std::vector<int> & ys);
216 void setData(
const QVector<float> & x,
const QVector<float> & y);
217 void setData(
const std::vector<float> & x,
const std::vector<float> & y);
218 void setData(
const QVector<float> & y);
219 void setData(
const std::vector<float> & y);
230 void attach(
UPlot * plot);
231 void detach(
UPlot * plot);
233 const QVector<float> &
getMinMax()
const {
return _minMax;}
234 int removeItem(
int index);
237 virtual void update(
float scaleX,
float scaleY,
float offsetX,
float offsetY,
float xDir,
float yDir,
int maxItemsKept);
276 void setThreshold(
float threshold);
284 virtual void update(
float scaleX,
float scaleY,
float offsetX,
float offsetY,
float xDir,
float yDir,
int maxItemsKept);
308 void setAxis(
float &
min,
float &
max);
316 int step()
const {
return _step;}
324 void setReversed(
bool reversed);
327 virtual void paintEvent(QPaintEvent * event);
355 QPixmap createSymbol(
const QPen & pen,
const QBrush & brush);
366 virtual void contextMenuEvent(QContextMenuEvent * event);
395 void setFlat(
bool on);
401 void removeLegendItem(
const UPlotCurve * curve);
406 void legendItemRemoved(
const UPlotCurve * curve);
407 void legendItemToggled(
const UPlotCurve * curve,
bool toggled);
408 void legendItemMoved(
const UPlotCurve * curve,
int);
411 virtual void contextMenuEvent(QContextMenuEvent * event);
414 void redirectToggled(
bool);
445 QSize sizeHint()
const;
446 QSize minimumSizeHint()
const;
448 virtual void paintEvent(QPaintEvent* event);
491 UPlot(QWidget * parent = 0);
497 UPlotCurve * addCurve(
const QString & curveName,
const QColor & color = QColor());
501 bool addCurve(
UPlotCurve * curve,
bool ownershipTransferred =
true);
505 QStringList curveNames();
506 bool contains(
const QString & curveName);
512 QString
title()
const {
return this->objectName();}
513 QPen getRandomPenColored();
514 void showLegend(
bool shown);
515 void showGrid(
bool shown);
516 void showRefreshRate(
bool shown);
517 void trackMouse(
bool tracking);
518 void keepAllData(
bool kept);
519 void showXAxis(
bool shown) {_horizontalAxis->setVisible(shown);}
520 void showYAxis(
bool shown) {_verticalAxis->setVisible(shown);}
523 void setFixedXAxis(
float x1,
float x2);
524 void setFixedYAxis(
float y1,
float y2);
525 void setMaxVisibleItems(
int maxVisibleItems);
526 void setTitle(
const QString & text);
527 void setXLabel(
const QString & text);
528 void setYLabel(
const QString & text, Qt::Orientation
orientation = Qt::Vertical);
529 void setWorkingDirectory(
const QString & workingDirectory);
530 void setGraphicsView(
bool on);
531 void setBackgroundColor(
const QColor & color);
532 QRectF sceneRect()
const;
540 void showCurve(
const UPlotCurve * curve,
bool shown);
549 void captureScreen();
551 void moveCurve(
const UPlotCurve *,
int index);
554 virtual void contextMenuEvent(QContextMenuEvent * event);
555 virtual void paintEvent(QPaintEvent * event);
556 virtual void resizeEvent(QResizeEvent * event);
557 virtual void mousePressEvent(QMouseEvent * event);
558 virtual void mouseMoveEvent(QMouseEvent * event);
559 virtual void mouseReleaseEvent(QMouseEvent * event);
560 virtual void mouseDoubleClickEvent(QMouseEvent * event);
564 void addItem(QGraphicsItem * item);
567 void replot(QPainter * painter);
568 bool updateAxis(
float x,
float y);
569 bool updateAxis(
float x1,
float x2,
float y1,
float y2);
571 void createActions();
573 void selectScreenCaptureFormat();
574 bool mousePosToValue(
const QPoint & pos,
float & x,
float & y);
581 float _axisMaximums[4];
582 bool _axisMaximumsSet[4];
QString _autoScreenCaptureFormat
QGraphicsTextItem * _text
const QVector< float > & getMinMax() const
QGraphicsItem * _sceneRoot
UPlotAxis * _verticalAxis
QList< UPlotCurve * > _curves
GLM_FUNC_DECL genType min(genType const &x, genType const &y)
QGraphicsRectItem * _textBackground
QAction * _aAddVerticalLine
UPlotItem * _previousItem
QAction * _aMouseTracking
UOrientableLabel * _yLabel
QWidget * _graphicsViewHolder
Qt::Orientation _orientation
QTime _refreshIntervalTime
QAction * _aChangeBackgroundColor
UPlotItem * previousItem() const
virtual void update(float scaleX, float scaleY, float offsetX, float offsetY, float xDir, float yDir, int maxItemsKept)
QString _workingDirectory
const QBrush & brush() const
void showYAxis(bool shown)
UPlotAxis * _horizontalAxis
QAction * _aCopyAllCurveToClipboard
const QPointF & data() const
virtual bool isMinMaxValid() const
Qt::Orientation _orientation
QAction * _aShowRefreshRate
QAction * _aAddHorizontalLine
QList< QGraphicsItem * > _items
void addValue(int pos, float val, float *vals, T *point, T *points, int n)
virtual bool isMinMaxValid() const
QAction * _aYLabelVertical
QGraphicsRectItem * _rootItem
QList< QGraphicsLineItem * > vGridLines
QAction * _aCopyToClipboard
QAction * _aAutoScreenCapture
GLM_FUNC_DECL genType max(genType const &x, genType const &y)
Qt::Orientation orientation() const
UPlotItem * nextItem() const
QAction * _aUseFlatButtons
const UPlotCurve * curve() const
void showXAxis(bool shown)
QColor itemsColor() const
QList< QGraphicsLineItem * > hGridLines
Qt::Orientation _orientation
GLM_FUNC_DECL detail::tmat4x4< T, P > orientation(detail::tvec3< T, P > const &Normal, detail::tvec3< T, P > const &Up)