Loading...
Searching...
No Matches
ClickableLabelItem.hpp
1#pragma once
2#include <score/graphics/TextItem.hpp>
3
4#include <QGraphicsItem>
5#include <QString>
6
7#include <functional>
8#include <verdigris>
9
10namespace score
11{
12class ModelMetadata;
13}
14class QGraphicsSceneHoverEvent;
15class QGraphicsSceneMouseEvent;
16
17namespace Scenario
18{
19class SeparatorItem final : public QGraphicsItem
20{
21public:
22 SeparatorItem(QGraphicsItem* parent);
23
24 // QGraphicsItem interface
25public:
26 QRectF boundingRect() const override;
27 void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
28 override;
29};
30
32 : // public QObject,
34{
35 W_OBJECT(ClickableLabelItem)
36public:
37 using ClickHandler = std::function<void(ClickableLabelItem*)>;
39 score::ModelMetadata& interval, ClickHandler&& onClick, const QString& text,
40 QGraphicsItem* parent);
41
42 int index() const;
43 void setIndex(int index);
44
45public:
46 void textChanged() W_SIGNAL(textChanged);
47
48protected:
49 void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
50 void hoverEnterEvent(QGraphicsSceneHoverEvent* event) override;
51 void hoverLeaveEvent(QGraphicsSceneHoverEvent* event) override;
52
53private:
54 int m_index{-1};
55 ClickHandler m_onClick;
56};
57}
Definition ClickableLabelItem.hpp:34
Definition ClickableLabelItem.hpp:20
The ModelMetadata class.
Definition ModelMetadata.hpp:22
Definition TextItem.hpp:28
Main plug-in of score.
Definition score-plugin-dataflow/Dataflow/PortItem.hpp:13
Base toolkit upon which the software is built.
Definition Application.cpp:90