41 lines
798 B
C++
41 lines
798 B
C++
#ifndef IMAGEVIEW_H
|
|
#define IMAGEVIEW_H
|
|
|
|
#include <QGraphicsView>
|
|
#include <QGraphicsScene>
|
|
#include <QGraphicsPixmapItem>
|
|
#include <QRubberBand>
|
|
#include <QMouseEvent>
|
|
#include "QGraphicsScene"
|
|
#include "QGraphicsView"
|
|
#include "QGraphicsPixmapItem"
|
|
|
|
class ImageView : public QGraphicsView
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit ImageView(QWidget *parent = nullptr);
|
|
QGraphicsPixmapItem *pximg;
|
|
QGraphicsScene *scene;
|
|
bool state;
|
|
|
|
|
|
protected:
|
|
void mousePressEvent(QMouseEvent *event) override;
|
|
void mouseMoveEvent(QMouseEvent *event) override;
|
|
void mouseReleaseEvent(QMouseEvent *event) override;
|
|
|
|
|
|
signals:
|
|
void roiSelected(const QRectF &roi);
|
|
|
|
private:
|
|
|
|
QRubberBand *rubberBand;
|
|
QPoint origin;
|
|
|
|
};
|
|
|
|
#endif // IMAGEVIEW_H
|