Loading...
Searching...
No Matches
CurveView.hpp
1#pragma once
2
3#include <QGraphicsItem>
4#include <QPoint>
5#include <QRect>
6
7#include <score_plugin_curve_export.h>
8
9#include <verdigris>
10
11class QGraphicsSceneContextMenuEvent;
12class QGraphicsSceneMouseEvent;
13class QKeyEvent;
14class QPainter;
15class QStyleOptionGraphicsItem;
16class QWidget;
17
18namespace Curve
19{
20class Presenter;
21class Model;
22class SCORE_PLUGIN_CURVE_EXPORT View final
23 : public QObject
24 , public QGraphicsItem
25{
26 W_OBJECT(View)
27 Q_INTERFACES(QGraphicsItem)
28public:
29 explicit View(QGraphicsItem* parent) noexcept;
30 ~View() override;
31
32 void setModel(const Curve::Presenter* p, const Curve::Model* m) noexcept;
33 void setDirectDraw(bool) noexcept;
34 void setDefaultWidth(double w) noexcept;
35 void setRect(const QRectF& theRect) noexcept;
36 QRectF boundingRect() const override;
37
38 void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
39 override;
40
41 void setSelectionArea(const QRectF&) noexcept;
42 QPixmap pixmap() noexcept;
43
44 void setValueTooltip(QPointF pos, const QString&) noexcept;
45
46public:
47 void pressed(QPointF arg_1) E_SIGNAL(SCORE_PLUGIN_CURVE_EXPORT, pressed, arg_1)
48 void moved(QPointF arg_1) E_SIGNAL(SCORE_PLUGIN_CURVE_EXPORT, moved, arg_1)
49 void released(QPointF arg_1) E_SIGNAL(SCORE_PLUGIN_CURVE_EXPORT, released, arg_1)
50 void doubleClick(QPointF arg_1) E_SIGNAL(SCORE_PLUGIN_CURVE_EXPORT, doubleClick, arg_1)
51
52 void escPressed() E_SIGNAL(SCORE_PLUGIN_CURVE_EXPORT, escPressed)
53
54 void keyPressed(int arg_1) E_SIGNAL(SCORE_PLUGIN_CURVE_EXPORT, keyPressed, arg_1)
55 void keyReleased(int arg_1) E_SIGNAL(SCORE_PLUGIN_CURVE_EXPORT, keyReleased, arg_1)
56
57 void contextMenuRequested(const QPoint& arg_1, const QPointF& arg_2)
58 E_SIGNAL(SCORE_PLUGIN_CURVE_EXPORT, contextMenuRequested, arg_1, arg_2)
59
60private:
61 void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
62 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) override;
63 void mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
64 void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
65
66 void keyPressEvent(QKeyEvent* ev) override;
67 void keyReleaseEvent(QKeyEvent* ev) override;
68
69 void contextMenuEvent(QGraphicsSceneContextMenuEvent*) override;
70
71 void drawAllPoints(QPainter* painter);
72 void drawOptimized(QPainter* painter);
73
74 const Curve::Presenter* m_presenter{};
75 const Curve::Model* m_model{};
76 QRectF m_rect; // The rect in which the whole curve must fit.
77 QRectF m_selectArea;
78 QPointF m_tooltipPos;
79 QString m_tooltip;
80 double m_defaultW{};
81 bool m_directDraw{false};
82};
83}
Definition CurveModel.hpp:25
Definition CurvePresenter.hpp:32
Definition CurveView.hpp:25
Utilities and base classes for 1D curves.
Definition FocusDispatcher.hpp:12