2024-02-06 06:19:53 +00:00
|
|
|
#ifndef MYGRAPHICSVIEW_H
|
|
|
|
#define MYGRAPHICSVIEW_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QGraphicsView>
|
|
|
|
#include <QMouseEvent>
|
|
|
|
#include <QWheelEvent>
|
|
|
|
#include <QScrollBar>
|
|
|
|
#include "datafile/view/mygraphicsscene.h"
|
|
|
|
|
|
|
|
class MyGraphicsView : public QGraphicsView
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
MyGraphicsView();
|
|
|
|
~MyGraphicsView();
|
|
|
|
|
|
|
|
private:
|
|
|
|
MyGraphicsScene *m_scene;
|
|
|
|
QSize m_viewSize;
|
|
|
|
|
|
|
|
//鼠标起始点和结束点
|
|
|
|
QPoint m_startPoint;
|
|
|
|
QPoint m_endPoint;
|
|
|
|
bool m_leftBtnPressed = false;
|
|
|
|
bool m_rightBtnPressed = false;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent *event);//窗口大小发生变化的时候,该函数触发
|
|
|
|
void mouseDoubleClickEvent(QMouseEvent *event);
|
|
|
|
void mousePressEvent(QMouseEvent *event);
|
|
|
|
void mouseReleaseEvent(QMouseEvent *event);
|
|
|
|
void mouseMoveEvent(QMouseEvent *event);
|
|
|
|
void wheelEvent(QWheelEvent *event);
|
|
|
|
|
|
|
|
public:
|
2024-03-08 08:33:05 +00:00
|
|
|
QPicture getPictureByDat(Marker marker,int penWidth = 1);
|
|
|
|
QPicture getPictureByBmp(QPixmap pixmap,int penWidth = 1);
|
|
|
|
QPainterPath getDrawPath();
|
|
|
|
void creatViewPathAndPic(QPainterPath path,QPicture pic);
|
2024-02-06 06:19:53 +00:00
|
|
|
void cleanView();
|
2024-03-08 08:33:05 +00:00
|
|
|
void swithViewByPic(QPicture pic);
|
|
|
|
void swithViewByPath(QPainterPath path);
|
2024-02-06 06:19:53 +00:00
|
|
|
void reflushBlockView(QPoint p);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void siMouseMove(QPointF point);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MYGRAPHICSVIEW_H
|