QGraphicsToggle.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 QGraphicsToggle final
14  : public QObject
15  , public QGraphicsItem
16 {
17  W_OBJECT(QGraphicsToggle)
18  SCORE_GRAPHICS_ITEM_TYPE(240)
19  QRectF m_rect{defaultToggleSize};
20 
21  QString m_textToggled{};
22  QString m_textUntoggled{};
23  bool m_toggled{};
24 
25 public:
27  const QString& textUntoggled, const QString& textToggled, QGraphicsItem* parent);
28 
29  void toggle();
30  void setState(bool toggled);
31  bool state() const noexcept { return m_toggled; }
32 
33  void toggled(bool arg_1) E_SIGNAL(SCORE_LIB_BASE_EXPORT, toggled, arg_1)
34 
35  void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
36  void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
37  QRectF boundingRect() const override;
38  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
39  override;
40 };
41 }
Definition: QGraphicsToggle.hpp:16
Base toolkit upon which the software is built.
Definition: Application.cpp:90