Changeset View
Changeset View
Standalone View
Standalone View
src/acbf/AcbfTextarea.cpp
Context not available. | |||||
45 | : QObject(parent) | 45 | : QObject(parent) | ||
---|---|---|---|---|---|
46 | , d(new Private) | 46 | , d(new Private) | ||
47 | { | 47 | { | ||
48 | qRegisterMetaType<Textarea*>("Textarea*"); | ||||
49 | connect(this, SIGNAL(pointCountChanged()), this, SIGNAL(boundsChanged())); | ||||
48 | } | 50 | } | ||
49 | 51 | | |||
50 | Textarea::~Textarea() = default; | 52 | Textarea::~Textarea() = default; | ||
Context not available. | |||||
150 | else { | 152 | else { | ||
151 | d->points.append(point); | 153 | d->points.append(point); | ||
152 | } | 154 | } | ||
155 | emit pointCountChanged(); | ||||
153 | } | 156 | } | ||
154 | 157 | | |||
155 | void Textarea::removePoint(const QPoint& point) | 158 | void Textarea::removePoint(const QPoint& point) | ||
156 | { | 159 | { | ||
157 | d->points.removeAll(point); | 160 | d->points.removeAll(point); | ||
161 | emit pointCountChanged(); | ||||
158 | } | 162 | } | ||
159 | 163 | | |||
160 | bool Textarea::swapPoints(const QPoint& swapThis, const QPoint& withThis) | 164 | bool Textarea::swapPoints(const QPoint& swapThis, const QPoint& withThis) | ||
Context not available. | |||||
163 | int index2 = d->points.indexOf(withThis); | 167 | int index2 = d->points.indexOf(withThis); | ||
164 | if(index1 > -1 && index2 > -1) { | 168 | if(index1 > -1 && index2 > -1) { | ||
165 | d->points.swap(index1, index2); | 169 | d->points.swap(index1, index2); | ||
170 | emit pointCountChanged(); | ||||
166 | return true; | 171 | return true; | ||
167 | } | 172 | } | ||
168 | return false; | 173 | return false; | ||
169 | } | 174 | } | ||
175 | void Textarea::setPointsFromRect(const QPoint &topLeft, const QPoint &bottomRight) | ||||
176 | { | ||||
177 | QRect rect(topLeft, bottomRight); | ||||
178 | d->points.clear(); | ||||
179 | d->points.append(topLeft); | ||||
180 | d->points.append(rect.topRight()); | ||||
181 | d->points.append(rect.bottomRight()); | ||||
182 | d->points.append(rect.bottomLeft()); | ||||
183 | emit pointCountChanged(); | ||||
184 | } | ||||
185 | | ||||
186 | int Textarea::pointCount() const | ||||
187 | { | ||||
188 | return d->points.size(); | ||||
189 | } | ||||
190 | | ||||
191 | QRect Textarea::bounds() const | ||||
192 | { | ||||
193 | // Would use QPolygon here, but that requires including QTGUI. | ||||
194 | QRect rect(d->points.at(0), d->points.at(1)); | ||||
195 | for (int i = 2; i < d->points.size(); i++) { | ||||
196 | QPoint p = d->points.at(i); | ||||
197 | if (rect.left() > p.x()) { | ||||
198 | rect.setLeft(p.x()); | ||||
199 | } | ||||
200 | if (rect.right() < p.x()) { | ||||
201 | rect.setRight(p.x()); | ||||
202 | } | ||||
203 | if (rect.bottom() < p.y()) { | ||||
204 | rect.setBottom(p.y()); | ||||
205 | } | ||||
206 | if (rect.top() > p.y()) { | ||||
207 | rect.setTop(p.y()); | ||||
208 | } | ||||
209 | } | ||||
210 | return rect; | ||||
211 | } | ||||
170 | 212 | | |||
171 | QString Textarea::bgcolor() const | 213 | QString Textarea::bgcolor() const | ||
172 | { | 214 | { | ||
Context not available. | |||||
176 | void Textarea::setBgcolor(const QString& newColor) | 218 | void Textarea::setBgcolor(const QString& newColor) | ||
177 | { | 219 | { | ||
178 | d->bgcolor = newColor; | 220 | d->bgcolor = newColor; | ||
221 | emit bgcolorChanged(); | ||||
179 | } | 222 | } | ||
180 | 223 | | |||
181 | void Textarea::setTextRotation(int rotation) | 224 | void Textarea::setTextRotation(int rotation) | ||
182 | { | 225 | { | ||
183 | d->textRotation = rotation; | 226 | d->textRotation = rotation; | ||
227 | emit textRotationChanged(); | ||||
184 | } | 228 | } | ||
185 | 229 | | |||
186 | int Textarea::textRotation() const | 230 | int Textarea::textRotation() const | ||
Context not available. | |||||
196 | void Textarea::setType(const QString& type) | 240 | void Textarea::setType(const QString& type) | ||
197 | { | 241 | { | ||
198 | d->type = type; | 242 | d->type = type; | ||
243 | emit typeChanged(); | ||||
199 | } | 244 | } | ||
200 | 245 | | |||
201 | QStringList Textarea::availableTypes() | 246 | QStringList Textarea::availableTypes() | ||
Context not available. | |||||
222 | void Textarea::setInverted(bool inverted) | 267 | void Textarea::setInverted(bool inverted) | ||
223 | { | 268 | { | ||
224 | d->inverted = inverted; | 269 | d->inverted = inverted; | ||
270 | emit invertedChanged(); | ||||
225 | } | 271 | } | ||
226 | 272 | | |||
227 | bool Textarea::transparent() const | 273 | bool Textarea::transparent() const | ||
Context not available. | |||||
232 | void Textarea::setTransparent(bool transparent) | 278 | void Textarea::setTransparent(bool transparent) | ||
233 | { | 279 | { | ||
234 | d->transparent = transparent; | 280 | d->transparent = transparent; | ||
281 | emit transparentChanged(); | ||||
235 | } | 282 | } | ||
236 | 283 | | |||
237 | QStringList Textarea::paragraphs() const | 284 | QStringList Textarea::paragraphs() const | ||
Context not available. | |||||
242 | void Textarea::setParagraphs(const QStringList& paragraphs) | 289 | void Textarea::setParagraphs(const QStringList& paragraphs) | ||
243 | { | 290 | { | ||
244 | d->paragraphs = paragraphs; | 291 | d->paragraphs = paragraphs; | ||
292 | emit paragraphsChanged(); | ||||
245 | } | 293 | } | ||
Context not available. |