PlotterHMI/datafile/view/mygraphicsscene.h
huahaiyan 3ce55cebbd 20240308
1、梳理代码,修改绘制会绘制两次的bug;
2、增加正向旋转功能,线宽设置功能;
3、测试压缩算法,完成;
2024-03-08 16:33:05 +08:00

42 lines
1.0 KiB
C++

#ifndef MYGRAPHICSSCENE_H
#define MYGRAPHICSSCENE_H
#include <QObject>
#include <QGraphicsScene>
#include "datafile/view/mygraphicsitem.h"
#define DRAWMARGINS 200.0 //item在场景中绘制时的边距(留边)
class MyGraphicsScene: public QGraphicsScene
{
Q_OBJECT
public:
MyGraphicsScene();
~MyGraphicsScene();
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent);
void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent);
private:
MyGraphicsItem *m_myGraphicsItem;
public:
void createScenePathAndPic(QPainterPath path,QPicture pic);
void addItemToScene();
void cleanScene();
QPicture getPictureByDat(Marker marker,int penWidth = 1);
QPicture getPictureByBmp(QPixmap pixmap,int penWidth = 1);
QPainterPath getDrawPath();
void swithSceneByPic(QPicture pic);
void swithSceneByPath(QPainterPath path);
void ReflushBlockScene(QPoint p);
signals:
public slots:
};
#endif // MYGRAPHICSSCENE_H