GradientView.hpp
1 #pragma once
2 #include <Process/LayerView.hpp>
3 
4 #include <Color/GradientModel.hpp>
5 
6 #include <verdigris>
7 namespace Gradient
8 {
9 class View final : public Process::LayerView
10 {
11  W_OBJECT(View)
12 public:
13  View(QGraphicsItem* parent);
14 
15  using gradient_colors = ossia::flat_map<double, QColor>;
16  void setGradient(const gradient_colors& c);
17  void setDataWidth(double);
18  double dataWidth() const { return m_dataWidth; }
19 
20 public:
21  void dropPoint(double pos, QColor arg_2)
22  E_SIGNAL(SCORE_PLUGIN_AUTOMATION_EXPORT, dropPoint, pos, arg_2);
23  void setColor(double pos, QColor arg_2)
24  E_SIGNAL(SCORE_PLUGIN_AUTOMATION_EXPORT, setColor, pos, arg_2);
25  void movePoint(double old, double cur)
26  E_SIGNAL(SCORE_PLUGIN_AUTOMATION_EXPORT, movePoint, old, cur);
27  void removePoint(double pos)
28  E_SIGNAL(SCORE_PLUGIN_AUTOMATION_EXPORT, removePoint, pos);
29 
30 private:
31  void paint_impl(QPainter*) const override;
32 
33  void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
34  void mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
35  void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
36  void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) override;
37 
38  void dragEnterEvent(QGraphicsSceneDragDropEvent* event) override;
39  void dragMoveEvent(QGraphicsSceneDragDropEvent* event) override;
40  void dragLeaveEvent(QGraphicsSceneDragDropEvent* event) override;
41  void dropEvent(QGraphicsSceneDragDropEvent* event) override;
42 
43  ossia::flat_map<double, QColor> m_colors;
44  ossia::flat_map<double, QColor> m_origColors;
45  std::optional<double> m_clicked;
46  double m_dataWidth{};
47 };
48 }
Definition: GradientView.hpp:10
Definition: LayerView.hpp:21