1 Star 0 Fork 20

liuhaobest/Qtweiniu

forked from 1ndu5try/Qtweiniu 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
ChartView.h 1.04 KB
一键复制 编辑 原始数据 按行查看 历史
unknown 提交于 2022-08-04 19:07 . tijao
#pragma once
#include <QChartView>
#include <QMouseEvent>
#include <QGraphicsSimpleTextItem>
#include<QVector>
#include<QLineSeries>
#include<QGraphicsEllipseItem>
#include<QGraphicsLineItem>
QT_CHARTS_USE_NAMESPACE
////现程序未使用qchart 以下代码仅供参考
class ChartView : public QChartView
{
Q_OBJECT
public:
ChartView(QWidget *parent = nullptr);
//~ChartView();
// 保存坐标区域,用于复位
void saveAxisRange();
protected:
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void wheelEvent(QWheelEvent *event);
void leaveEvent(QEvent *event);
private:
QPoint m_lastPoint;
bool m_isPress = false;
bool m_ctrlPress;
bool m_alreadySaveRange;
double m_xMin, m_xMax, m_yMin, m_yMax;
QGraphicsLineItem* x_line = nullptr;
QGraphicsLineItem*y_line= nullptr;
QLineSeries* serice= nullptr;
QGraphicsSimpleTextItem* m_coordItem= nullptr;
QGraphicsEllipseItem* thepoint= nullptr;
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/liuhaobest/qtweiniu.git
git@gitee.com:liuhaobest/qtweiniu.git
liuhaobest
qtweiniu
Qtweiniu
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385