FastTrack 6.1.0
Tracks multiples objects dealing with occlusion and identities.
Loading...
Searching...
No Matches
imageviewer.h
1/*
2This file is part of Fast Track.
3
4 FastTrack is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 FastTrack is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with FastTrack. If not, see <https://www.gnu.org/licenses/>.
16*/
17
18#ifndef IMAGEVIEWER_H
19#define IMAGEVIEWER_H
20
21#include <QApplication>
22#include <QGraphicsPixmapItem>
23#include <QGraphicsRectItem>
24#include <QGraphicsScene>
25#include <QGraphicsView>
26#include <QMouseEvent>
27#include <QPainter>
28#include <QPixmap>
29#include <QScrollBar>
30#include <QWheelEvent>
31#include <QWidget>
32
33class ImageViewer : public QGraphicsView {
34 Q_OBJECT
35
36 public:
37 ImageViewer(QWidget *parent = nullptr);
38 ImageViewer &operator=(const ImageViewer &T) = delete;
39 ImageViewer &operator=(ImageViewer &&T) = delete;
40 ImageViewer(ImageViewer &&T) = delete;
41 ~ImageViewer() = default;
42 void setImage(const QImage &image);
43 void fitToView();
44 void clear();
45 void setRectangle(const QRect &rect);
46
47 private:
48 QGraphicsScene *scene;
49 QGraphicsPixmapItem *image;
50 QGraphicsRectItem *rectangle;
51 double factor;
52 double currentZoom;
53 QPoint panReferenceClick;
54 void wheelEvent(QWheelEvent *event) override;
55 void mousePressEvent(QMouseEvent *event) override;
56 void mouseReleaseEvent(QMouseEvent *event) override;
57 void mouseMoveEvent(QMouseEvent *event) override;
58};
59#endif // IMAGEVIEWER_H