#pragma once #include <QWidget> #include <QPaintEvent> #include <QPainter> #include <QPixmap> #include <QBrush> #include <QPen> #include <QRect> #include <QImage> #include <QMouseEvent> #include <QDebug> #include <QString> #include <QPoint> #include <QInputDialog> #include <QMessageBox> #include <vector> #include "vcpoint.h" class VCImgWidget :public QWidget { Q_OBJECT public: VCImgWidget(QWidget *parent); ~VCImgWidget(); void paintEvent(QPaintEvent *event); void paintEvent1(QPaintEvent *event); //const QString imgName = NULL; void SetImgName(QString imgNameParam); QString GetImgName(); std::vector<vcp::VCPoint> getVecPoints(); std::vector<vcp::VCPoint> getVecPointsPolygon(); void clearVecPointsData(); void clearVecPolygonPointsData(); int getDrawType(); void setDrawType(int typeNum); void setClickCount(int clickCountParam); int getClickCount(); double getDistanceBetween(QPoint startPoint, QPoint endPoint); protected: void mousePressEvent(QMouseEvent * event); void mouseReleaseEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event); signals: void showLabels(QString labelStr,int num); private slots: //void clearVecPointsData(); private: QString imgName = NULL; QPoint startPoint; QPoint endPoint; QPoint minPoint; QPoint startPointPolygon; int rectNum; bool isStart; QString labelStr; int drawType; //0 默认 1 矩形 2 多边形 std::vector<vcp::VCPoint> vec_vcpoint; std::vector<vcp::VCPoint> vec_vcpoint_polygon; int clickCount; bool isStartDrawRect = false; };