Changeset View
Changeset View
Standalone View
Standalone View
src/acbf/AcbfTextarea.h
Context not available. | |||||
27 | #include "AcbfTextlayer.h" | 27 | #include "AcbfTextlayer.h" | ||
---|---|---|---|---|---|
28 | 28 | | |||
29 | #include <QPoint> | 29 | #include <QPoint> | ||
30 | #include <QRect> | ||||
30 | 31 | | |||
31 | /** | 32 | /** | ||
32 | * \brief Class to handle the text areas in ACBF | 33 | * \brief Class to handle the text areas in ACBF | ||
Context not available. | |||||
40 | class ACBF_EXPORT Textarea : public QObject | 41 | class ACBF_EXPORT Textarea : public QObject | ||
41 | { | 42 | { | ||
42 | Q_OBJECT | 43 | Q_OBJECT | ||
44 | Q_PROPERTY(QString bgcolor READ bgcolor WRITE setBgcolor NOTIFY bgcolorChanged) | ||||
45 | Q_PROPERTY(int pointCount READ pointCount NOTIFY pointCountChanged) | ||||
46 | Q_PROPERTY(QRect bounds READ bounds NOTIFY boundsChanged) | ||||
47 | Q_PROPERTY(int textRotation READ textRotation WRITE setTextRotation NOTIFY textRotationChanged) | ||||
48 | Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged) | ||||
49 | Q_PROPERTY(bool inverted READ inverted WRITE setInverted NOTIFY invertedChanged) | ||||
50 | Q_PROPERTY(bool transparent READ transparent WRITE setTransparent NOTIFY transparentChanged) | ||||
51 | Q_PROPERTY(QStringList paragraphs READ paragraphs WRITE setParagraphs NOTIFY paragraphsChanged) | ||||
52 | | ||||
43 | public: | 53 | public: | ||
44 | explicit Textarea(Textlayer* parent = nullptr); | 54 | explicit Textarea(Textlayer* parent = nullptr); | ||
45 | ~Textarea() override; | 55 | ~Textarea() override; | ||
Context not available. | |||||
67 | * @param index - the index of the desired point. | 77 | * @param index - the index of the desired point. | ||
68 | * @return a point for an index. | 78 | * @return a point for an index. | ||
69 | */ | 79 | */ | ||
70 | QPoint point(int index) const; | 80 | Q_INVOKABLE QPoint point(int index) const; | ||
71 | /** | 81 | /** | ||
72 | * @param point - a point from the points list. | 82 | * @param point - a point from the points list. | ||
73 | * @return the index of the given point. | 83 | * @return the index of the given point. | ||
74 | */ | 84 | */ | ||
75 | int pointIndex(const QPoint& point) const; | 85 | Q_INVOKABLE int pointIndex(const QPoint& point) const; | ||
76 | 86 | | |||
77 | /** | 87 | /** | ||
78 | * \brief add a point to the points list. | 88 | * \brief add a point to the points list. | ||
Context not available. | |||||
80 | * @param index - the index to add it at. If afterIndex is larger than zero, | 90 | * @param index - the index to add it at. If afterIndex is larger than zero, | ||
81 | * the insertion will happen at that index | 91 | * the insertion will happen at that index | ||
82 | */ | 92 | */ | ||
83 | void addPoint(const QPoint& point, int index = -1); | 93 | Q_INVOKABLE void addPoint(const QPoint& point, int index = -1); | ||
84 | /** | 94 | /** | ||
85 | * \brief remove a point from the list. | 95 | * \brief remove a point from the list. | ||
86 | * @param point - point to remove from the list. | 96 | * @param point - point to remove from the list. | ||
87 | */ | 97 | */ | ||
88 | void removePoint(const QPoint& point); | 98 | Q_INVOKABLE void removePoint(const QPoint& point); | ||
89 | /** | 99 | /** | ||
90 | * \brief Swap two points in the list. | 100 | * \brief Swap two points in the list. | ||
91 | * @param swapThis - the first points to swap. | 101 | * @param swapThis - the first points to swap. | ||
92 | * @param withThis - the second points to swap. | 102 | * @param withThis - the second points to swap. | ||
93 | */ | 103 | */ | ||
94 | bool swapPoints(const QPoint& swapThis, const QPoint& withThis); | 104 | bool swapPoints(const QPoint& swapThis, const QPoint& withThis); | ||
105 | /** | ||||
106 | * @brief set the points based on a top left and bottom right. | ||||
107 | * @param topLeft the topleft corner of the rect. | ||||
108 | * @param bottomRight the bottomright corner of the rect. | ||||
109 | */ | ||||
110 | Q_INVOKABLE void setPointsFromRect(const QPoint& topLeft, const QPoint& bottomRight); | ||||
95 | 111 | | |||
112 | int pointCount() const; | ||||
113 | /** | ||||
114 | * @brief fires when the point counts changes. | ||||
115 | */ | ||||
116 | Q_SIGNAL void pointCountChanged(); | ||||
117 | /** | ||||
118 | * @brief convenience function to get the ractangle of the points. | ||||
119 | * @return the bounds of the frame. | ||||
120 | */ | ||||
121 | QRect bounds() const; | ||||
122 | /** | ||||
123 | * @brief fires when the bounds change, which happens when the point count changes. | ||||
124 | */ | ||||
125 | Q_SIGNAL void boundsChanged(); | ||||
96 | /** | 126 | /** | ||
97 | * @return the background color as a QString. | 127 | * @return the background color as a QString. | ||
98 | * | 128 | * | ||
Context not available. | |||||
105 | * @param newColor - a String with an 8bit per channel rgb hexcode (#ff00ff, or the like) | 135 | * @param newColor - a String with an 8bit per channel rgb hexcode (#ff00ff, or the like) | ||
106 | */ | 136 | */ | ||
107 | void setBgcolor(const QString& newColor = QString()); | 137 | void setBgcolor(const QString& newColor = QString()); | ||
138 | /** | ||||
139 | * @brief fires when the background color changes. | ||||
140 | */ | ||||
141 | Q_SIGNAL void bgcolorChanged(); | ||||
108 | 142 | | |||
109 | /** | 143 | /** | ||
110 | * @return the text rotation in degrees. | 144 | * @return the text rotation in degrees. | ||
Context not available. | |||||
115 | * @param rotation - the text rotation in degrees. | 149 | * @param rotation - the text rotation in degrees. | ||
116 | */ | 150 | */ | ||
117 | void setTextRotation(int rotation = 0); | 151 | void setTextRotation(int rotation = 0); | ||
152 | /** | ||||
153 | * @brief fires when the text rotation is set. | ||||
154 | */ | ||||
155 | Q_SIGNAL void textRotationChanged(); | ||||
118 | 156 | | |||
119 | /** | 157 | /** | ||
120 | * @return the type of the text area. This determines how it is styled. | 158 | * @return the type of the text area. This determines how it is styled. | ||
Context not available. | |||||
126 | * it will change the way how the text is styled. The default is "speech". | 164 | * it will change the way how the text is styled. The default is "speech". | ||
127 | */ | 165 | */ | ||
128 | void setType(const QString& type = QStringLiteral("speech")); | 166 | void setType(const QString& type = QStringLiteral("speech")); | ||
167 | /** | ||||
168 | * @brief fires when the type is set. | ||||
169 | */ | ||||
170 | Q_SIGNAL void typeChanged(); | ||||
129 | 171 | | |||
130 | /** | 172 | /** | ||
131 | * @return whether the text should use the 'inverted' colorscheme. | 173 | * @return whether the text should use the 'inverted' colorscheme. | ||
Context not available. | |||||
136 | * @param inverted - whether to do so. | 178 | * @param inverted - whether to do so. | ||
137 | */ | 179 | */ | ||
138 | void setInverted(bool inverted = false); | 180 | void setInverted(bool inverted = false); | ||
139 | 181 | /** | |||
182 | * @brief fires when inverted is set. | ||||
183 | */ | ||||
184 | Q_SIGNAL void invertedChanged(); | ||||
140 | /** | 185 | /** | ||
141 | * @return whether to use the background color when overlaying the text. | 186 | * @return whether to use the background color when overlaying the text. | ||
142 | */ | 187 | */ | ||
Context not available. | |||||
147 | * to have the textare background transparent. | 192 | * to have the textare background transparent. | ||
148 | */ | 193 | */ | ||
149 | void setTransparent(bool transparent = false); | 194 | void setTransparent(bool transparent = false); | ||
195 | /** | ||||
196 | * @brief fires when transparent is set. | ||||
197 | */ | ||||
198 | Q_SIGNAL void transparentChanged(); | ||||
150 | 199 | | |||
151 | /** | 200 | /** | ||
152 | * @returns a list of paragraphs. | 201 | * @returns a list of paragraphs. | ||
Context not available. | |||||
163 | * strong, emphasis, strikethrough, sub, sup, a (with mandatory href attribute only) | 212 | * strong, emphasis, strikethrough, sub, sup, a (with mandatory href attribute only) | ||
164 | */ | 213 | */ | ||
165 | void setParagraphs(const QStringList& paragraphs); | 214 | void setParagraphs(const QStringList& paragraphs); | ||
215 | /** | ||||
216 | * @brief fires when the paragraphs are set. | ||||
217 | */ | ||||
218 | Q_SIGNAL void paragraphsChanged(); | ||||
166 | private: | 219 | private: | ||
167 | class Private; | 220 | class Private; | ||
168 | std::unique_ptr<Private> d; | 221 | std::unique_ptr<Private> d; | ||
Context not available. |