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  Q_INTERFACES(QGraphicsItem)
19  QRectF m_rect{defaultToggleSize};
20 
21  bool m_pressed{};
22 
23 public:
24  QGraphicsButton(QGraphicsItem* parent);
25 
26  void bang();
27 
28  void pressed(bool b) E_SIGNAL(SCORE_LIB_BASE_EXPORT, pressed, b)
29 
30 private:
31  void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
32  void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
33  QRectF boundingRect() const override;
34  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
35  override;
36 };
37 }
Definition: QGraphicsButton.hpp:16
Base toolkit upon which the software is built.
Definition: Application.cpp:90