重写图线显示
This commit is contained in:
@@ -1,16 +1,60 @@
|
||||
#ifndef CHART_H
|
||||
#ifndef CHART_H
|
||||
#define CHART_H
|
||||
|
||||
#include <QObject>
|
||||
#include "QWidget"
|
||||
#include "QDebug"
|
||||
#include "QChart"
|
||||
#include <QChartView>
|
||||
#include <QLineSeries>
|
||||
#include <QValueAxis>
|
||||
#include <QDateTimeAxis>
|
||||
#include <QSplineSeries>
|
||||
|
||||
class Chart : public QObject
|
||||
#include <QMouseEvent>
|
||||
#include <QGraphicsSimpleTextItem>
|
||||
|
||||
using namespace QtCharts;
|
||||
|
||||
class Chart : public QChartView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Chart(QObject *parent = nullptr);
|
||||
explicit Chart( QWidget *parent = nullptr);
|
||||
explicit Chart(QChart *chart, QWidget *parent = nullptr);
|
||||
|
||||
~Chart();
|
||||
|
||||
protected:
|
||||
|
||||
bool event(QEvent *event);
|
||||
|
||||
void mouseMoveEvent(QMouseEvent *e);
|
||||
void mouseReleaseEvent(QMouseEvent *e);
|
||||
void mousePressEvent(QMouseEvent *e);
|
||||
void mouseDoubleClickEvent(QMouseEvent *e);
|
||||
void wheelEvent(QWheelEvent *e);
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
|
||||
signals:
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
QGraphicsSimpleTextItem *m_coordItem;
|
||||
|
||||
QVariant m_xMin;
|
||||
QVariant m_xMax;
|
||||
QVariant m_yMin;
|
||||
QVariant m_yMax;
|
||||
|
||||
QPoint lastPoint;
|
||||
|
||||
bool isPress = false;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // CHART_H
|
||||
|
||||
Reference in New Issue
Block a user