qabstractplot.h 910 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef QABSTRACTPLOT_H
  2. #define QABSTRACTPLOT_H
  3. #include <QQuickPaintedItem>
  4. #include "thirdparty/qcustomplot/qcustomplot.h"
  5. class QAbstractPlot : public QQuickPaintedItem
  6. {
  7. Q_OBJECT
  8. public:
  9. QAbstractPlot(QQuickItem *parent = nullptr);
  10. ~QAbstractPlot();
  11. QCustomPlot* customPlot();
  12. void setOpenGL(bool enabled);
  13. protected:
  14. virtual void paint(QPainter *painter);
  15. virtual void postMouseEvents(QMouseEvent* event);
  16. virtual void postWheelEvents(QWheelEvent* event);
  17. virtual void mousePressEvent(QMouseEvent* event);
  18. virtual void mouseReleaseEvent(QMouseEvent* event);
  19. virtual void mouseMoveEvent(QMouseEvent* event);
  20. virtual void mouseDoubleClickEvent(QMouseEvent* event);
  21. virtual void wheelEvent(QWheelEvent *event);
  22. protected:
  23. void onPlotSizeChanged();
  24. void onPlotUpdate();
  25. private:
  26. QCustomPlot* m_pCustomPlot;
  27. };
  28. #endif // QABSTRACTPLOT_H