CurvePointView.hpp
1 #pragma once
2 #include <score/model/IdentifiedObjectMap.hpp>
3 #include <score/model/Identifier.hpp>
4 
5 #include <QGraphicsItem>
6 #include <QPoint>
7 #include <QRect>
8 
9 #include <score_plugin_curve_export.h>
10 
11 #include <verdigris>
12 
13 class QGraphicsSceneContextMenuEvent;
14 class QPainter;
15 class QStyleOptionGraphicsItem;
16 class QWidget;
17 namespace Curve
18 {
19 class PointModel;
20 struct Style;
21 class SCORE_PLUGIN_CURVE_EXPORT PointView final
22  : public QObject
23  , public QGraphicsItem
24 {
25  W_OBJECT(PointView)
26  Q_INTERFACES(QGraphicsItem)
27 public:
28  PointView(const PointModel* model, const Curve::Style& style, QGraphicsItem* parent);
29 
30  const PointModel& model() const;
31  const Id<PointModel>& id() const;
32 
33  static const constexpr int Type = QGraphicsItem::UserType + 100;
34  int type() const final override { return Type; }
35 
36  QRectF boundingRect() const override;
37  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
38  override;
39 
40  void setSelected(bool selected);
41 
42  void enable();
43  void disable();
44 
45  void setModel(const PointModel* model);
46 
47 public:
48  void contextMenuRequested(const QPoint& arg_1, const QPointF& arg_2)
49  E_SIGNAL(SCORE_PLUGIN_CURVE_EXPORT, contextMenuRequested, arg_1, arg_2)
50 protected:
51  void contextMenuEvent(QGraphicsSceneContextMenuEvent*) override;
52 
53 private:
54  const PointModel* m_model{};
55  const Curve::Style& m_style;
56  bool m_selected{};
57 };
58 }
59 
60 #if !defined(SCORE_ALL_UNITY)
61 //extern template class IdContainer<Curve::PointView, Curve::PointModel>;
62 #endif
Definition: CurvePointModel.hpp:18
Definition: CurvePointView.hpp:24
The id_base_t class.
Definition: Identifier.hpp:57
Utilities and base classes for 1D curves.
Definition: FocusDispatcher.hpp:12
Definition: CurveStyle.hpp:13