QGraphicsButton.hpp
1 #pragma once
2 #include <score/graphics/widgets/Constants.hpp>
3 
4 #include <QGraphicsItem>
5 #include <QObject>
6 
7 #include <score_lib_base_export.h>
8 
9 #include <verdigris>
10 
11 namespace score
12 {
13 class SCORE_LIB_BASE_EXPORT QGraphicsButton final
14  : public QObject
15  , public QGraphicsItem
16 {
17  W_OBJECT(QGraphicsButton)
18  SCORE_GRAPHICS_ITEM_TYPE(10)
19  QRectF m_rect{defaultToggleSize};
20 
21  bool m_pressed{};
22 
23 public:
24  explicit QGraphicsButton(QGraphicsItem* parent);
25  ~QGraphicsButton();
26 
27  void bang();
28 
29  void pressed(bool b) E_SIGNAL(SCORE_LIB_BASE_EXPORT, pressed, b)
30 
31 private:
32  void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
33  void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
34  QRectF boundingRect() const override;
35  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
36  override;
37 };
38 }
Definition: QGraphicsButton.hpp:16
Base toolkit upon which the software is built.
Definition: Application.cpp:90