Loading...
Searching...
No Matches
TextItem.hpp
1#pragma once
2#include <score/model/ColorReference.hpp>
3
4#include <QGraphicsSceneMouseEvent>
5#include <QGraphicsTextItem>
6
7#include <score_lib_base_export.h>
8
9#include <verdigris>
10namespace score
11{
12class SCORE_LIB_BASE_EXPORT TextItem final : public QGraphicsTextItem
13{
14 W_OBJECT(TextItem)
15public:
16 TextItem(QString text, QGraphicsItem* parent);
17
18public:
19 void focusOut() E_SIGNAL(SCORE_LIB_BASE_EXPORT, focusOut)
20
21protected:
22 void focusOutEvent(QFocusEvent* event) override;
23};
24
25class SCORE_LIB_BASE_EXPORT SimpleTextItem
26 : public QObject
27 , public QGraphicsItem
28{
29public:
30 SimpleTextItem(const score::BrushSet& col, QGraphicsItem*);
31
32 QRectF boundingRect() const final override;
33 void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
34 final override;
35
36 void setFont(const QFont& f);
37 void setText(const QString& s);
38 void setText(std::string_view s);
39 void setColor(const score::BrushSet& c);
40 const QString& text() const noexcept;
41
42private:
43 SimpleTextItem() = delete;
44 SimpleTextItem(const SimpleTextItem&) = delete;
46 SimpleTextItem& operator=(const SimpleTextItem&) = delete;
47 SimpleTextItem& operator=(SimpleTextItem&&) = delete;
48 void updateImpl();
49
50 QRectF m_rect;
51 const score::BrushSet* m_color{};
52 QFont m_font;
53 QString m_string;
54 QImage m_line;
55};
56}
Definition TextItem.hpp:28
Definition TextItem.hpp:13
Base toolkit upon which the software is built.
Definition Application.cpp:90
Definition Skin.hpp:19