Swiftray  1.0
text.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <QMouseEvent>
5 #include <shape/text-shape.h>
6 
7 namespace Controls {
8 
9  class Text : public CanvasControl {
10  public:
11  Text(Canvas *canvas) noexcept;
12 
13  bool mouseReleaseEvent(QMouseEvent *e) override;
14 
15  bool hoverEvent(QHoverEvent *e, Qt::CursorShape *cursor) override;
16 
17  bool keyPressEvent(QKeyEvent *e) override;
18 
19  void paint(QPainter *painter) override;
20 
21  bool isActive() override;
22 
23  void exit() override;
24 
25  TextShape &target();
26 
27  void setTarget(ShapePtr &target);
28 
29  private:
30  ShapePtr target_;
31  };
32 
33 }
Definition: canvas.h:27
Definition: canvas-control.h:16
Canvas & canvas()
Definition: canvas-control.cpp:34
Definition: text.h:9
bool isActive() override
Definition: text.cpp:16
bool mouseReleaseEvent(QMouseEvent *e) override
Definition: text.cpp:20
bool hoverEvent(QHoverEvent *e, Qt::CursorShape *cursor) override
Definition: text.cpp:32
void paint(QPainter *painter) override
Definition: text.cpp:45
Text(Canvas *canvas) noexcept
Definition: text.cpp:12
void exit() override
Definition: text.cpp:58
TextShape & target()
Definition: text.cpp:77
bool keyPressEvent(QKeyEvent *e) override
Definition: text.cpp:37
void setTarget(ShapePtr &target)
Definition: text.cpp:81
Definition: text-shape.h:6
In-canvas controls with its own painting and event handling functions.
Definition: canvas-control.h:8
shared_ptr< Shape > ShapePtr
Definition: shape.h:137