Geometrize  1.0
An application for geometrizing images into geometric primitives
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
imagetaskscene.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 
5 #include <QGraphicsScene>
6 
8 #include "svgitem.h"
9 
10 class QEvent;
11 class QFocusEvent;
12 class QKeyEvent;
13 class QGraphicsSceneWheelEvent;
14 
15 namespace geometrize
16 {
17 
18 namespace scene
19 {
20 
24 class ImageTaskScene : public QGraphicsScene
25 {
26  Q_OBJECT
27 
28 public:
29  explicit ImageTaskScene(QObject* parent = nullptr);
30  virtual ~ImageTaskScene();
31 
36  void setTargetPixmapOpacity(float opacity);
37 
42  void setTargetPixmap(const QPixmap& pixmap);
43 
49 
54  void setOverlayShape(SvgItem* item);
55 
60  void setOverlayShapeVisibility(bool visible);
61 
62 protected:
63  bool event(QEvent* event) override;
64  void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
65  void mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
66  void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
67  void wheelEvent(QGraphicsSceneWheelEvent* event) override;
68  void keyPressEvent(QKeyEvent* event) override;
69  void keyReleaseEvent(QKeyEvent* event) override;
70  void focusInEvent(QFocusEvent* event) override;
71  void focusOutEvent(QFocusEvent* event) override;
72 
73 private:
75  std::unique_ptr<ImageTaskSceneImpl> d;
76 };
77 
78 }
79 
80 }
The SvgItem class represents an SVG graphic that is drawn as part of a scene.
Definition: svgitem.h:15
void keyReleaseEvent(QKeyEvent *event) override
Definition: imagetaskscene.cpp:155
void focusOutEvent(QFocusEvent *event) override
Definition: imagetaskscene.cpp:165
void setOverlayShape(SvgItem *item)
setOverlayItem Sets the given overlay shape upon the scene.
Definition: imagetaskscene.cpp:106
ImageTaskPixmapGraphicsItem & getTargetPixmapItem()
getTargetPixmapItem Gets a refernece to the graphics item that houses the target pixmap.
Definition: imagetaskscene.cpp:101
void focusInEvent(QFocusEvent *event) override
Definition: imagetaskscene.cpp:160
void setTargetPixmapOpacity(float opacity)
setTargetPixmapOpacity Sets the opacity of the target pixmap.
Definition: imagetaskscene.cpp:91
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override
Definition: imagetaskscene.cpp:135
void keyPressEvent(QKeyEvent *event) override
Definition: imagetaskscene.cpp:150
bool event(QEvent *event) override
Definition: imagetaskscene.cpp:116
The ImageTaskPixmapGraphicsItem class models a pixmap graphic item that goes into the scene for an im...
Definition: imagetaskpixmapgraphicsitem.h:25
void setOverlayShapeVisibility(bool visible)
setOverlayShapeVisibility Whether the overlay shape(s) in the scene should be visible.
Definition: imagetaskscene.cpp:111
The ImageTaskScene class models a graphics scene for viewing the results of image tasks...
Definition: imagetaskscene.h:24
void wheelEvent(QGraphicsSceneWheelEvent *event) override
Definition: imagetaskscene.cpp:145
void mousePressEvent(QGraphicsSceneMouseEvent *event) override
Definition: imagetaskscene.cpp:130
virtual ~ImageTaskScene()
Definition: imagetaskscene.cpp:87
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override
Definition: imagetaskscene.cpp:140
void setTargetPixmap(const QPixmap &pixmap)
setTargetPixmap Sets the pixmap that provides the target/goal image visualization.
Definition: imagetaskscene.cpp:96
ImageTaskScene(QObject *parent=nullptr)
Definition: imagetaskscene.cpp:83
std::unique_ptr< ImageTaskSceneImpl > d
Definition: imagetaskscene.h:74