代码拉取完成,页面将自动刷新
#ifndef MYGRAPHICSVIEW_H
#define MYGRAPHICSVIEW_H
#include <QGraphicsView>
#include <QGraphicsScene>
#include <QGraphicsPixmapItem>
#include <QGraphicsSimpleTextItem>
#include <QWheelEvent>
#include <QTimer>
#include <QMenu>
#include <QAction>
#include <QFileDialog>
#include <QColorDialog>
class MyGraphicsView : public QGraphicsView
{
public:
MyGraphicsView(QWidget *parent = nullptr);
~MyGraphicsView();
enum COORD_TYPE{
REALTIVE,
ABSOLUTE
};
void showImage(const QString &filename);
protected:
virtual void wheelEvent(QWheelEvent *event);
virtual void mouseMoveEvent(QMouseEvent *event);
virtual void mousePressEvent(QMouseEvent *event) ;
virtual void mouseReleaseEvent(QMouseEvent *event) ;
private slots:
void slotChangeImgTriggered();
void slotCoordTypeTriggered();
void slotTextColorTriggered();
void slotClearTriggered();
private:
void menuInit();
QMenu *pMenu;
QAction *pChangeImg;
QAction *pCoordType;
QAction *pTextColor;
QAction *pClear;
QString mFileName;
bool IS_RELATIVE;
bool IS_Translate;
bool IS_Translate2;
bool IS_Menu;
QTimer *pTimer;
QGraphicsScene *pScene;
QGraphicsPixmapItem *pixmapItem;
QList<QGraphicsSimpleTextItem *> mSimpleTextItemList;
QColor mTextColor;
QPoint mLastPos;
QSize imgSize;
COORD_TYPE mCoordType;
};
#endif // MYGRAPHICSVIEW_H
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。