Line | Source Code | Coverage |
---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - |
4 | ** Contact: http://www.qt-project.org/legal | - |
5 | ** | - |
6 | ** This file is part of the QtGui module of the Qt Toolkit. | - |
7 | ** | - |
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
9 | ** Commercial License Usage | - |
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
11 | ** accordance with the commercial license agreement provided with the | - |
12 | ** Software or, alternatively, in accordance with the terms contained in | - |
13 | ** a written agreement between you and Digia. For licensing terms and | - |
14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
15 | ** use the contact form at http://qt.digia.com/contact-us. | - |
16 | ** | - |
17 | ** GNU Lesser General Public License Usage | - |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
19 | ** General Public License version 2.1 as published by the Free Software | - |
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
21 | ** packaging of this file. Please review the following information to | - |
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
24 | ** | - |
25 | ** In addition, as a special exception, Digia gives you certain additional | - |
26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
28 | ** | - |
29 | ** GNU General Public License Usage | - |
30 | ** Alternatively, this file may be used under the terms of the GNU | - |
31 | ** General Public License version 3.0 as published by the Free Software | - |
32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
33 | ** packaging of this file. Please review the following information to | - |
34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
36 | ** | - |
37 | ** | - |
38 | ** $QT_END_LICENSE$ | - |
39 | ** | - |
40 | ****************************************************************************/ | - |
41 | | - |
42 | #include "qtextformat.h" | - |
43 | #include "qtextformat_p.h" | - |
44 | | - |
45 | #include <qvariant.h> | - |
46 | #include <qdatastream.h> | - |
47 | #include <qdebug.h> | - |
48 | #include <qmap.h> | - |
49 | #include <qhash.h> | - |
50 | | - |
51 | QT_BEGIN_NAMESPACE | - |
52 | | - |
53 | /*! | - |
54 | \class QTextLength | - |
55 | \reentrant | - |
56 | | - |
57 | \brief The QTextLength class encapsulates the different types of length | - |
58 | used in a QTextDocument. | - |
59 | \inmodule QtGui | - |
60 | | - |
61 | \ingroup richtext-processing | - |
62 | | - |
63 | When we specify a value for the length of an element in a text document, | - |
64 | we often need to provide some other information so that the length is | - |
65 | used in the way we expect. For example, when we specify a table width, | - |
66 | the value can represent a fixed number of pixels, or it can be a percentage | - |
67 | value. This information changes both the meaning of the value and the way | - |
68 | it is used. | - |
69 | | - |
70 | Generally, this class is used to specify table widths. These can be | - |
71 | specified either as a fixed amount of pixels, as a percentage of the | - |
72 | containing frame's width, or by a variable width that allows it to take | - |
73 | up just the space it requires. | - |
74 | | - |
75 | \sa QTextTable | - |
76 | */ | - |
77 | | - |
78 | /*! | - |
79 | \fn explicit QTextLength::QTextLength() | - |
80 | | - |
81 | Constructs a new length object which represents a variable size. | - |
82 | */ | - |
83 | | - |
84 | /*! | - |
85 | \fn QTextLength::QTextLength(Type type, qreal value) | - |
86 | | - |
87 | Constructs a new length object of the given \a type and \a value. | - |
88 | */ | - |
89 | | - |
90 | /*! | - |
91 | \fn Type QTextLength::type() const | - |
92 | | - |
93 | Returns the type of this length object. | - |
94 | | - |
95 | \sa QTextLength::Type | - |
96 | */ | - |
97 | | - |
98 | /*! | - |
99 | \fn qreal QTextLength::value(qreal maximumLength) const | - |
100 | | - |
101 | Returns the effective length, constrained by the type of the length object | - |
102 | and the specified \a maximumLength. | - |
103 | | - |
104 | \sa type() | - |
105 | */ | - |
106 | | - |
107 | /*! | - |
108 | \fn qreal QTextLength::rawValue() const | - |
109 | | - |
110 | Returns the constraint value that is specific for the type of the length. | - |
111 | If the length is QTextLength::PercentageLength then the raw value is in | - |
112 | percent, in the range of 0 to 100. If the length is QTextLength::FixedLength | - |
113 | then that fixed amount is returned. For variable lengths, zero is returned. | - |
114 | */ | - |
115 | | - |
116 | /*! | - |
117 | \fn bool QTextLength::operator==(const QTextLength &other) const | - |
118 | | - |
119 | Returns true if this text length is the same as the \a other text | - |
120 | length. | - |
121 | */ | - |
122 | | - |
123 | /*! | - |
124 | \fn bool QTextLength::operator!=(const QTextLength &other) const | - |
125 | | - |
126 | Returns true if this text length is different from the \a other text | - |
127 | length. | - |
128 | */ | - |
129 | | - |
130 | /*! | - |
131 | \enum QTextLength::Type | - |
132 | | - |
133 | This enum describes the different types a length object can | - |
134 | have. | - |
135 | | - |
136 | \value VariableLength The width of the object is variable | - |
137 | \value FixedLength The width of the object is fixed | - |
138 | \value PercentageLength The width of the object is in | - |
139 | percentage of the maximum width | - |
140 | | - |
141 | \sa type() | - |
142 | */ | - |
143 | | - |
144 | /*! | - |
145 | Returns the text length as a QVariant | - |
146 | */ | - |
147 | QTextLength::operator QVariant() const | - |
148 | { | - |
149 | return QVariant(QVariant::TextLength, this); executed: return QVariant(QVariant::TextLength, this); Execution Count:294 | 294 |
150 | } | - |
151 | | - |
152 | #ifndef QT_NO_DATASTREAM | - |
153 | QDataStream &operator<<(QDataStream &stream, const QTextLength &length) | - |
154 | { | - |
155 | return stream << qint32(length.lengthType) << double(length.fixedValueOrPercentage); executed: return stream << qint32(length.lengthType) << double(length.fixedValueOrPercentage); Execution Count:1 | 1 |
156 | } | - |
157 | | - |
158 | QDataStream &operator>>(QDataStream &stream, QTextLength &length) | - |
159 | { | - |
160 | qint32 type; executed (the execution status of this line is deduced): qint32 type; | - |
161 | double fixedValueOrPercentage; executed (the execution status of this line is deduced): double fixedValueOrPercentage; | - |
162 | stream >> type >> fixedValueOrPercentage; executed (the execution status of this line is deduced): stream >> type >> fixedValueOrPercentage; | - |
163 | length.fixedValueOrPercentage = fixedValueOrPercentage; executed (the execution status of this line is deduced): length.fixedValueOrPercentage = fixedValueOrPercentage; | - |
164 | length.lengthType = QTextLength::Type(type); executed (the execution status of this line is deduced): length.lengthType = QTextLength::Type(type); | - |
165 | return stream; executed: return stream; Execution Count:2 | 2 |
166 | } | - |
167 | #endif // QT_NO_DATASTREAM | - |
168 | | - |
169 | class QTextFormatPrivate : public QSharedData | - |
170 | { | - |
171 | public: | - |
172 | QTextFormatPrivate() : hashDirty(true), fontDirty(true), hashValue(0) {} executed: } Execution Count:24627 | 24627 |
173 | | - |
174 | struct Property | - |
175 | { | - |
176 | inline Property(qint32 k, const QVariant &v) : key(k), value(v) {} executed: } Execution Count:287483 | 287483 |
177 | inline Property() {} | - |
178 | | - |
179 | qint32 key; | - |
180 | QVariant value; | - |
181 | | - |
182 | inline bool operator==(const Property &other) const | - |
183 | { return key == other.key && value == other.value; } executed: return key == other.key && value == other.value; Execution Count:3187 | 3187 |
184 | inline bool operator!=(const Property &other) const | - |
185 | { return key != other.key || value != other.value; } never executed: return key != other.key || value != other.value; | 0 |
186 | }; | - |
187 | | - |
188 | inline uint hash() const | - |
189 | { | - |
190 | if (!hashDirty) evaluated: !hashDirty yes Evaluation Count:76812 | yes Evaluation Count:8841 |
| 8841-76812 |
191 | return hashValue; executed: return hashValue; Execution Count:76812 | 76812 |
192 | return recalcHash(); executed: return recalcHash(); Execution Count:8841 | 8841 |
193 | } | - |
194 | | - |
195 | inline bool operator==(const QTextFormatPrivate &rhs) const { | - |
196 | if (hash() != rhs.hash()) evaluated: hash() != rhs.hash() yes Evaluation Count:50 | yes Evaluation Count:21503 |
| 50-21503 |
197 | return false; executed: return false; Execution Count:50 | 50 |
198 | | - |
199 | return props == rhs.props; executed: return props == rhs.props; Execution Count:21503 | 21503 |
200 | } | - |
201 | | - |
202 | inline void insertProperty(qint32 key, const QVariant &value) | - |
203 | { | - |
204 | hashDirty = true; executed (the execution status of this line is deduced): hashDirty = true; | - |
205 | if (key >= QTextFormat::FirstFontProperty && key <= QTextFormat::LastFontProperty) evaluated: key >= QTextFormat::FirstFontProperty yes Evaluation Count:276978 | yes Evaluation Count:39077 |
evaluated: key <= QTextFormat::LastFontProperty yes Evaluation Count:211464 | yes Evaluation Count:65514 |
| 39077-276978 |
206 | fontDirty = true; executed: fontDirty = true; Execution Count:211464 | 211464 |
207 | for (int i = 0; i < props.count(); ++i) evaluated: i < props.count() yes Evaluation Count:2810407 | yes Evaluation Count:287483 |
| 287483-2810407 |
208 | if (props.at(i).key == key) { evaluated: props.at(i).key == key yes Evaluation Count:28572 | yes Evaluation Count:2781835 |
| 28572-2781835 |
209 | props[i].value = value; executed (the execution status of this line is deduced): props[i].value = value; | - |
210 | return; executed: return; Execution Count:28572 | 28572 |
211 | } | - |
212 | props.append(Property(key, value)); executed (the execution status of this line is deduced): props.append(Property(key, value)); | - |
213 | } executed: } Execution Count:287483 | 287483 |
214 | | - |
215 | inline void clearProperty(qint32 key) | - |
216 | { | - |
217 | for (int i = 0; i < props.count(); ++i) evaluated: i < props.count() yes Evaluation Count:10411 | yes Evaluation Count:49154 |
| 10411-49154 |
218 | if (props.at(i).key == key) { evaluated: props.at(i).key == key yes Evaluation Count:1028 | yes Evaluation Count:9383 |
| 1028-9383 |
219 | hashDirty = true; executed (the execution status of this line is deduced): hashDirty = true; | - |
220 | if (key >= QTextFormat::FirstFontProperty && key <= QTextFormat::LastFontProperty) evaluated: key >= QTextFormat::FirstFontProperty yes Evaluation Count:617 | yes Evaluation Count:411 |
evaluated: key <= QTextFormat::LastFontProperty yes Evaluation Count:296 | yes Evaluation Count:321 |
| 296-617 |
221 | fontDirty = true; executed: fontDirty = true; Execution Count:296 | 296 |
222 | props.remove(i); executed (the execution status of this line is deduced): props.remove(i); | - |
223 | return; executed: return; Execution Count:1028 | 1028 |
224 | } | - |
225 | } executed: } Execution Count:49154 | 49154 |
226 | | - |
227 | inline int propertyIndex(qint32 key) const | - |
228 | { | - |
229 | for (int i = 0; i < props.count(); ++i) evaluated: i < props.count() yes Evaluation Count:694913 | yes Evaluation Count:267295 |
| 267295-694913 |
230 | if (props.at(i).key == key) evaluated: props.at(i).key == key yes Evaluation Count:51019 | yes Evaluation Count:643894 |
| 51019-643894 |
231 | return i; executed: return i; Execution Count:51019 | 51019 |
232 | return -1; executed: return -1; Execution Count:267295 | 267295 |
233 | } | - |
234 | | - |
235 | inline QVariant property(qint32 key) const | - |
236 | { | - |
237 | const int idx = propertyIndex(key); executed (the execution status of this line is deduced): const int idx = propertyIndex(key); | - |
238 | if (idx < 0) evaluated: idx < 0 yes Evaluation Count:242028 | yes Evaluation Count:38462 |
| 38462-242028 |
239 | return QVariant(); executed: return QVariant(); Execution Count:242028 | 242028 |
240 | return props.at(idx).value; executed: return props.at(idx).value; Execution Count:38462 | 38462 |
241 | } | - |
242 | | - |
243 | inline bool hasProperty(qint32 key) const | - |
244 | { return propertyIndex(key) != -1; } executed: return propertyIndex(key) != -1; Execution Count:37824 | 37824 |
245 | | - |
246 | void resolveFont(const QFont &defaultFont); | - |
247 | | - |
248 | inline const QFont &font() const { | - |
249 | if (fontDirty) evaluated: fontDirty yes Evaluation Count:2975 | yes Evaluation Count:15681 |
| 2975-15681 |
250 | recalcFont(); executed: recalcFont(); Execution Count:2975 | 2975 |
251 | return fnt; executed: return fnt; Execution Count:18656 | 18656 |
252 | } | - |
253 | | - |
254 | QVector<Property> props; | - |
255 | private: | - |
256 | | - |
257 | uint recalcHash() const; | - |
258 | void recalcFont() const; | - |
259 | | - |
260 | mutable bool hashDirty; | - |
261 | mutable bool fontDirty; | - |
262 | mutable uint hashValue; | - |
263 | mutable QFont fnt; | - |
264 | | - |
265 | friend QDataStream &operator<<(QDataStream &, const QTextFormat &); | - |
266 | friend QDataStream &operator>>(QDataStream &, QTextFormat &); | - |
267 | }; | - |
268 | | - |
269 | // this is only safe because sizeof(int) == sizeof(float) | - |
270 | static inline uint hash(float d) | - |
271 | { | - |
272 | #ifdef Q_CC_GNU | - |
273 | // this is a GCC extension and isn't guaranteed to work in other compilers | - |
274 | // the reinterpret_cast below generates a strict-aliasing warning with GCC | - |
275 | union { float f; uint u; } cvt; executed (the execution status of this line is deduced): union { float f; uint u; } cvt; | - |
276 | cvt.f = d; executed (the execution status of this line is deduced): cvt.f = d; | - |
277 | return cvt.u; executed: return cvt.u; Execution Count:12387 | 12387 |
278 | #else | - |
279 | return reinterpret_cast<uint&>(d); | - |
280 | #endif | - |
281 | } | - |
282 | | - |
283 | static inline uint hash(const QColor &color) | - |
284 | { | - |
285 | return (color.isValid()) ? color.rgba() : 0x234109; executed: return (color.isValid()) ? color.rgba() : 0x234109; Execution Count:2495 | 2495 |
286 | } | - |
287 | | - |
288 | static inline uint hash(const QPen &pen) | - |
289 | { | - |
290 | return hash(pen.color()) + hash(pen.widthF()); never executed: return hash(pen.color()) + hash(pen.widthF()); | 0 |
291 | } | - |
292 | | - |
293 | static inline uint hash(const QBrush &brush) | - |
294 | { | - |
295 | return hash(brush.color()) + (brush.style() << 3); executed: return hash(brush.color()) + (brush.style() << 3); Execution Count:2494 | 2494 |
296 | } | - |
297 | | - |
298 | static inline uint variantHash(const QVariant &variant) | - |
299 | { | - |
300 | // simple and fast hash functions to differentiate between type and value | - |
301 | switch (variant.userType()) { // sorted by occurrence frequency | - |
302 | case QVariant::String: return qHash(variant.toString()); executed: return qHash(variant.toString()); Execution Count:766 | 766 |
303 | case QVariant::Double: return hash(variant.toDouble()); executed: return hash(variant.toDouble()); Execution Count:12218 | 12218 |
304 | case QVariant::Int: return 0x811890 + variant.toInt(); executed: return 0x811890 + variant.toInt(); Execution Count:6172 | 6172 |
305 | case QVariant::Brush: | - |
306 | return 0x01010101 + hash(qvariant_cast<QBrush>(variant)); executed: return 0x01010101 + hash(qvariant_cast<QBrush>(variant)); Execution Count:2494 | 2494 |
307 | case QVariant::Bool: return 0x371818 + variant.toBool(); executed: return 0x371818 + variant.toBool(); Execution Count:1077 | 1077 |
308 | case QVariant::Pen: return 0x02020202 + hash(qvariant_cast<QPen>(variant)); never executed: return 0x02020202 + hash(qvariant_cast<QPen>(variant)); | 0 |
309 | case QVariant::List: | - |
310 | return 0x8377 + qvariant_cast<QVariantList>(variant).count(); executed: return 0x8377 + qvariant_cast<QVariantList>(variant).count(); Execution Count:94 | 94 |
311 | case QVariant::Color: return hash(qvariant_cast<QColor>(variant)); executed: return hash(qvariant_cast<QColor>(variant)); Execution Count:1 | 1 |
312 | case QVariant::TextLength: | - |
313 | return 0x377 + hash(qvariant_cast<QTextLength>(variant).rawValue()); executed: return 0x377 + hash(qvariant_cast<QTextLength>(variant).rawValue()); Execution Count:169 | 169 |
314 | case QMetaType::Float: return hash(variant.toFloat()); never executed: return hash(variant.toFloat()); | 0 |
315 | case QVariant::Invalid: return 0; never executed: return 0; | 0 |
316 | default: break; executed: break; Execution Count:33 | 33 |
317 | } | - |
318 | return qHash(variant.typeName()); executed: return qHash(variant.typeName()); Execution Count:33 | 33 |
319 | } | - |
320 | | - |
321 | static inline int getHash(const QTextFormatPrivate *d, int format) | - |
322 | { | - |
323 | return (d ? d->hash() : 0) + format; executed: return (d ? d->hash() : 0) + format; Execution Count:53431 | 53431 |
324 | } | - |
325 | | - |
326 | uint QTextFormatPrivate::recalcHash() const | - |
327 | { | - |
328 | hashValue = 0; executed (the execution status of this line is deduced): hashValue = 0; | - |
329 | for (QVector<Property>::ConstIterator it = props.constBegin(); it != props.constEnd(); ++it) evaluated: it != props.constEnd() yes Evaluation Count:23024 | yes Evaluation Count:8841 |
| 8841-23024 |
330 | hashValue += (it->key << 16) + variantHash(it->value); executed: hashValue += (it->key << 16) + variantHash(it->value); Execution Count:23024 | 23024 |
331 | | - |
332 | hashDirty = false; executed (the execution status of this line is deduced): hashDirty = false; | - |
333 | | - |
334 | return hashValue; executed: return hashValue; Execution Count:8841 | 8841 |
335 | } | - |
336 | | - |
337 | void QTextFormatPrivate::resolveFont(const QFont &defaultFont) | - |
338 | { | - |
339 | recalcFont(); executed (the execution status of this line is deduced): recalcFont(); | - |
340 | const uint oldMask = fnt.resolve(); executed (the execution status of this line is deduced): const uint oldMask = fnt.resolve(); | - |
341 | fnt = fnt.resolve(defaultFont); executed (the execution status of this line is deduced): fnt = fnt.resolve(defaultFont); | - |
342 | | - |
343 | if (hasProperty(QTextFormat::FontSizeAdjustment)) { evaluated: hasProperty(QTextFormat::FontSizeAdjustment) yes Evaluation Count:21 | yes Evaluation Count:12624 |
| 21-12624 |
344 | const qreal scaleFactors[7] = {qreal(0.7), qreal(0.8), qreal(1.0), qreal(1.2), qreal(1.5), qreal(2), qreal(2.4)}; executed (the execution status of this line is deduced): const qreal scaleFactors[7] = {qreal(0.7), qreal(0.8), qreal(1.0), qreal(1.2), qreal(1.5), qreal(2), qreal(2.4)}; | - |
345 | | - |
346 | const int htmlFontSize = qBound(0, property(QTextFormat::FontSizeAdjustment).toInt() + 3 - 1, 6); executed (the execution status of this line is deduced): const int htmlFontSize = qBound(0, property(QTextFormat::FontSizeAdjustment).toInt() + 3 - 1, 6); | - |
347 | | - |
348 | | - |
349 | if (defaultFont.pointSize() <= 0) { partially evaluated: defaultFont.pointSize() <= 0 no Evaluation Count:0 | yes Evaluation Count:21 |
| 0-21 |
350 | qreal pixelSize = scaleFactors[htmlFontSize] * defaultFont.pixelSize(); never executed (the execution status of this line is deduced): qreal pixelSize = scaleFactors[htmlFontSize] * defaultFont.pixelSize(); | - |
351 | fnt.setPixelSize(qRound(pixelSize)); never executed (the execution status of this line is deduced): fnt.setPixelSize(qRound(pixelSize)); | - |
352 | } else { | 0 |
353 | qreal pointSize = scaleFactors[htmlFontSize] * defaultFont.pointSizeF(); executed (the execution status of this line is deduced): qreal pointSize = scaleFactors[htmlFontSize] * defaultFont.pointSizeF(); | - |
354 | fnt.setPointSizeF(pointSize); executed (the execution status of this line is deduced): fnt.setPointSizeF(pointSize); | - |
355 | } executed: } Execution Count:21 | 21 |
356 | } | - |
357 | | - |
358 | fnt.resolve(oldMask); executed (the execution status of this line is deduced): fnt.resolve(oldMask); | - |
359 | } executed: } Execution Count:12645 | 12645 |
360 | | - |
361 | void QTextFormatPrivate::recalcFont() const | - |
362 | { | - |
363 | // update cached font as well | - |
364 | QFont f; executed (the execution status of this line is deduced): QFont f; | - |
365 | | - |
366 | bool hasSpacingInformation = false; executed (the execution status of this line is deduced): bool hasSpacingInformation = false; | - |
367 | QFont::SpacingType spacingType = QFont::PercentageSpacing; executed (the execution status of this line is deduced): QFont::SpacingType spacingType = QFont::PercentageSpacing; | - |
368 | qreal letterSpacing = 0.0; executed (the execution status of this line is deduced): qreal letterSpacing = 0.0; | - |
369 | | - |
370 | for (int i = 0; i < props.count(); ++i) { evaluated: i < props.count() yes Evaluation Count:81264 | yes Evaluation Count:15620 |
| 15620-81264 |
371 | switch (props.at(i).key) { | - |
372 | case QTextFormat::FontFamily: | - |
373 | f.setFamily(props.at(i).value.toString()); executed (the execution status of this line is deduced): f.setFamily(props.at(i).value.toString()); | - |
374 | break; executed: break; Execution Count:3551 | 3551 |
375 | case QTextFormat::FontPointSize: | - |
376 | f.setPointSizeF(props.at(i).value.toReal()); executed (the execution status of this line is deduced): f.setPointSizeF(props.at(i).value.toReal()); | - |
377 | break; executed: break; Execution Count:2998 | 2998 |
378 | case QTextFormat::FontPixelSize: | - |
379 | f.setPixelSize(props.at(i).value.toInt()); executed (the execution status of this line is deduced): f.setPixelSize(props.at(i).value.toInt()); | - |
380 | break; executed: break; Execution Count:12 | 12 |
381 | case QTextFormat::FontWeight: { | - |
382 | int weight = props.at(i).value.toInt(); executed (the execution status of this line is deduced): int weight = props.at(i).value.toInt(); | - |
383 | if (weight == 0) weight = QFont::Normal; executed: weight = QFont::Normal; Execution Count:2985 evaluated: weight == 0 yes Evaluation Count:2985 | yes Evaluation Count:90 |
| 90-2985 |
384 | f.setWeight(weight); executed (the execution status of this line is deduced): f.setWeight(weight); | - |
385 | break; } executed: break; Execution Count:3075 | 3075 |
386 | case QTextFormat::FontItalic: | - |
387 | f.setItalic(props.at(i).value.toBool()); executed (the execution status of this line is deduced): f.setItalic(props.at(i).value.toBool()); | - |
388 | break; executed: break; Execution Count:3013 | 3013 |
389 | case QTextFormat::FontUnderline: | - |
390 | if (! hasProperty(QTextFormat::TextUnderlineStyle)) // don't use the old one if the new one is there. evaluated: ! hasProperty(QTextFormat::TextUnderlineStyle) yes Evaluation Count:1 | yes Evaluation Count:3044 |
| 1-3044 |
391 | f.setUnderline(props.at(i).value.toBool()); executed: f.setUnderline(props.at(i).value.toBool()); Execution Count:1 | 1 |
392 | break; executed: break; Execution Count:3045 | 3045 |
393 | case QTextFormat::TextUnderlineStyle: | - |
394 | f.setUnderline(static_cast<QTextCharFormat::UnderlineStyle>(props.at(i).value.toInt()) == QTextCharFormat::SingleUnderline); executed (the execution status of this line is deduced): f.setUnderline(static_cast<QTextCharFormat::UnderlineStyle>(props.at(i).value.toInt()) == QTextCharFormat::SingleUnderline); | - |
395 | break; executed: break; Execution Count:3054 | 3054 |
396 | case QTextFormat::FontOverline: | - |
397 | f.setOverline(props.at(i).value.toBool()); executed (the execution status of this line is deduced): f.setOverline(props.at(i).value.toBool()); | - |
398 | break; executed: break; Execution Count:2978 | 2978 |
399 | case QTextFormat::FontStrikeOut: | - |
400 | f.setStrikeOut(props.at(i).value.toBool()); executed (the execution status of this line is deduced): f.setStrikeOut(props.at(i).value.toBool()); | - |
401 | break; executed: break; Execution Count:2974 | 2974 |
402 | case QTextFormat::FontLetterSpacingType: | - |
403 | spacingType = static_cast<QFont::SpacingType>(props.at(i).value.toInt()); executed (the execution status of this line is deduced): spacingType = static_cast<QFont::SpacingType>(props.at(i).value.toInt()); | - |
404 | hasSpacingInformation = true; executed (the execution status of this line is deduced): hasSpacingInformation = true; | - |
405 | break; executed: break; Execution Count:2969 | 2969 |
406 | case QTextFormat::FontLetterSpacing: | - |
407 | letterSpacing = props.at(i).value.toReal(); executed (the execution status of this line is deduced): letterSpacing = props.at(i).value.toReal(); | - |
408 | hasSpacingInformation = true; executed (the execution status of this line is deduced): hasSpacingInformation = true; | - |
409 | break; executed: break; Execution Count:2969 | 2969 |
410 | case QTextFormat::FontWordSpacing: | - |
411 | f.setWordSpacing(props.at(i).value.toReal()); executed (the execution status of this line is deduced): f.setWordSpacing(props.at(i).value.toReal()); | - |
412 | break; executed: break; Execution Count:2971 | 2971 |
413 | case QTextFormat::FontCapitalization: | - |
414 | f.setCapitalization(static_cast<QFont::Capitalization> (props.at(i).value.toInt())); executed (the execution status of this line is deduced): f.setCapitalization(static_cast<QFont::Capitalization> (props.at(i).value.toInt())); | - |
415 | break; executed: break; Execution Count:2975 | 2975 |
416 | case QTextFormat::FontFixedPitch: { | - |
417 | const bool value = props.at(i).value.toBool(); executed (the execution status of this line is deduced): const bool value = props.at(i).value.toBool(); | - |
418 | if (f.fixedPitch() != value) evaluated: f.fixedPitch() != value yes Evaluation Count:542 | yes Evaluation Count:2969 |
| 542-2969 |
419 | f.setFixedPitch(value); executed: f.setFixedPitch(value); Execution Count:542 | 542 |
420 | break; } executed: break; Execution Count:3511 | 3511 |
421 | case QTextFormat::FontStretch: | - |
422 | f.setStretch(props.at(i).value.toInt()); executed (the execution status of this line is deduced): f.setStretch(props.at(i).value.toInt()); | - |
423 | break; executed: break; Execution Count:2969 | 2969 |
424 | case QTextFormat::FontStyleHint: | - |
425 | f.setStyleHint(static_cast<QFont::StyleHint>(props.at(i).value.toInt()), f.styleStrategy()); executed (the execution status of this line is deduced): f.setStyleHint(static_cast<QFont::StyleHint>(props.at(i).value.toInt()), f.styleStrategy()); | - |
426 | break; executed: break; Execution Count:2971 | 2971 |
427 | case QTextFormat::FontHintingPreference: | - |
428 | f.setHintingPreference(static_cast<QFont::HintingPreference>(props.at(i).value.toInt())); never executed (the execution status of this line is deduced): f.setHintingPreference(static_cast<QFont::HintingPreference>(props.at(i).value.toInt())); | - |
429 | break; | 0 |
430 | case QTextFormat::FontStyleStrategy: | - |
431 | f.setStyleStrategy(static_cast<QFont::StyleStrategy>(props.at(i).value.toInt())); executed (the execution status of this line is deduced): f.setStyleStrategy(static_cast<QFont::StyleStrategy>(props.at(i).value.toInt())); | - |
432 | break; executed: break; Execution Count:2971 | 2971 |
433 | case QTextFormat::FontKerning: | - |
434 | f.setKerning(props.at(i).value.toBool()); executed (the execution status of this line is deduced): f.setKerning(props.at(i).value.toBool()); | - |
435 | break; executed: break; Execution Count:2969 | 2969 |
436 | default: | - |
437 | break; executed: break; Execution Count:29289 | 29289 |
438 | } | - |
439 | } executed: } Execution Count:81264 | 81264 |
440 | | - |
441 | if (hasSpacingInformation) evaluated: hasSpacingInformation yes Evaluation Count:2969 | yes Evaluation Count:12651 |
| 2969-12651 |
442 | f.setLetterSpacing(spacingType, letterSpacing); executed: f.setLetterSpacing(spacingType, letterSpacing); Execution Count:2969 | 2969 |
443 | | - |
444 | fnt = f; executed (the execution status of this line is deduced): fnt = f; | - |
445 | fontDirty = false; executed (the execution status of this line is deduced): fontDirty = false; | - |
446 | } executed: } Execution Count:15620 | 15620 |
447 | | - |
448 | #ifndef QT_NO_DATASTREAM | - |
449 | Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QTextFormat &fmt) | - |
450 | { | - |
451 | stream << fmt.format_type << fmt.properties(); never executed (the execution status of this line is deduced): stream << fmt.format_type << fmt.properties(); | - |
452 | return stream; never executed: return stream; | 0 |
453 | } | - |
454 | | - |
455 | Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt) | - |
456 | { | - |
457 | QMap<qint32, QVariant> properties; never executed (the execution status of this line is deduced): QMap<qint32, QVariant> properties; | - |
458 | stream >> fmt.format_type >> properties; never executed (the execution status of this line is deduced): stream >> fmt.format_type >> properties; | - |
459 | | - |
460 | // QTextFormat's default constructor doesn't allocate the private structure, so | - |
461 | // we have to do this, in case fmt is a default constructed value. | - |
462 | if(!fmt.d) | 0 |
463 | fmt.d = new QTextFormatPrivate(); never executed: fmt.d = new QTextFormatPrivate(); | 0 |
464 | | - |
465 | for (QMap<qint32, QVariant>::ConstIterator it = properties.constBegin(); never executed (the execution status of this line is deduced): for (QMap<qint32, QVariant>::ConstIterator it = properties.constBegin(); | - |
466 | it != properties.constEnd(); ++it) never evaluated: it != properties.constEnd() | 0 |
467 | fmt.d->insertProperty(it.key(), it.value()); never executed: fmt.d->insertProperty(it.key(), it.value()); | 0 |
468 | | - |
469 | return stream; never executed: return stream; | 0 |
470 | } | - |
471 | #endif // QT_NO_DATASTREAM | - |
472 | | - |
473 | /*! | - |
474 | \class QTextFormat | - |
475 | \reentrant | - |
476 | | - |
477 | \brief The QTextFormat class provides formatting information for a | - |
478 | QTextDocument. | - |
479 | \inmodule QtGui | - |
480 | | - |
481 | \ingroup richtext-processing | - |
482 | \ingroup shared | - |
483 | | - |
484 | A QTextFormat is a generic class used for describing the format of | - |
485 | parts of a QTextDocument. The derived classes QTextCharFormat, | - |
486 | QTextBlockFormat, QTextListFormat, and QTextTableFormat are usually | - |
487 | more useful, and describe the formatting that is applied to | - |
488 | specific parts of the document. | - |
489 | | - |
490 | A format has a \c FormatType which specifies the kinds of text item it | - |
491 | can format; e.g. a block of text, a list, a table, etc. A format | - |
492 | also has various properties (some specific to particular format | - |
493 | types), as described by the Property enum. Every property has a | - |
494 | corresponding Property. | - |
495 | | - |
496 | The format type is given by type(), and the format can be tested | - |
497 | with isCharFormat(), isBlockFormat(), isListFormat(), | - |
498 | isTableFormat(), isFrameFormat(), and isImageFormat(). If the | - |
499 | type is determined, it can be retrieved with toCharFormat(), | - |
500 | toBlockFormat(), toListFormat(), toTableFormat(), toFrameFormat(), | - |
501 | and toImageFormat(). | - |
502 | | - |
503 | A format's properties can be set with the setProperty() functions, | - |
504 | and retrieved with boolProperty(), intProperty(), doubleProperty(), | - |
505 | and stringProperty() as appropriate. All the property IDs used in | - |
506 | the format can be retrieved with allPropertyIds(). One format can | - |
507 | be merged into another using merge(). | - |
508 | | - |
509 | A format's object index can be set with setObjectIndex(), and | - |
510 | retrieved with objectIndex(). These methods can be used to | - |
511 | associate the format with a QTextObject. It is used to represent | - |
512 | lists, frames, and tables inside the document. | - |
513 | | - |
514 | \sa {Rich Text Processing} | - |
515 | */ | - |
516 | | - |
517 | /*! | - |
518 | \enum QTextFormat::FormatType | - |
519 | | - |
520 | This enum describes the text item a QTextFormat object is formatting. | - |
521 | | - |
522 | \value InvalidFormat An invalid format as created by the default | - |
523 | constructor | - |
524 | \value BlockFormat The object formats a text block | - |
525 | \value CharFormat The object formats a single character | - |
526 | \value ListFormat The object formats a list | - |
527 | \value TableFormat The object formats a table | - |
528 | \value FrameFormat The object formats a frame | - |
529 | | - |
530 | \value UserFormat | - |
531 | | - |
532 | \sa QTextCharFormat, QTextBlockFormat, QTextListFormat, | - |
533 | QTextTableFormat, type() | - |
534 | */ | - |
535 | | - |
536 | /*! | - |
537 | \enum QTextFormat::Property | - |
538 | | - |
539 | This enum describes the different properties a format can have. | - |
540 | | - |
541 | \value ObjectIndex The index of the formatted object. See objectIndex(). | - |
542 | | - |
543 | Paragraph and character properties | - |
544 | | - |
545 | \value CssFloat How a frame is located relative to the surrounding text | - |
546 | \value LayoutDirection The layout direction of the text in the document | - |
547 | (Qt::LayoutDirection). | - |
548 | | - |
549 | \value OutlinePen | - |
550 | \value ForegroundBrush | - |
551 | \value BackgroundBrush | - |
552 | \value BackgroundImageUrl | - |
553 | | - |
554 | Paragraph properties | - |
555 | | - |
556 | \value BlockAlignment | - |
557 | \value BlockTopMargin | - |
558 | \value BlockBottomMargin | - |
559 | \value BlockLeftMargin | - |
560 | \value BlockRightMargin | - |
561 | \value TextIndent | - |
562 | \value TabPositions Specifies the tab positions. The tab positions are structs of QTextOption::Tab which are stored in | - |
563 | a QList (internally, in a QList<QVariant>). | - |
564 | \value BlockIndent | - |
565 | \value LineHeight | - |
566 | \value LineHeightType | - |
567 | \value BlockNonBreakableLines | - |
568 | \value BlockTrailingHorizontalRulerWidth The width of a horizontal ruler element. | - |
569 | | - |
570 | Character properties | - |
571 | | - |
572 | \value FontFamily | - |
573 | \value FontPointSize | - |
574 | \value FontPixelSize | - |
575 | \value FontSizeAdjustment Specifies the change in size given to the fontsize already set using | - |
576 | FontPointSize or FontPixelSize. | - |
577 | \value FontFixedPitch | - |
578 | \omitvalue FontSizeIncrement | - |
579 | \value FontWeight | - |
580 | \value FontItalic | - |
581 | \value FontUnderline \e{This property has been deprecated.} Use QTextFormat::TextUnderlineStyle instead. | - |
582 | \value FontOverline | - |
583 | \value FontStrikeOut | - |
584 | \value FontCapitalization Specifies the capitalization type that is to be applied to the text. | - |
585 | \value FontLetterSpacingType Specifies the meaning of the FontLetterSpacing property. The default | - |
586 | is QFont::PercentageSpacing. | - |
587 | \value FontLetterSpacing Changes the default spacing between individual letters in the font. The value is | - |
588 | specified as a percentage or absolute value, depending on FontLetterSpacingType. | - |
589 | The default value is 100%. | - |
590 | \value FontWordSpacing Changes the default spacing between individual words. A positive value increases the word spacing | - |
591 | by the corresponding pixels; a negative value decreases the spacing. | - |
592 | \value FontStretch Corresponds to the QFont::Stretch property | - |
593 | \value FontStyleHint Corresponds to the QFont::StyleHint property | - |
594 | \value FontStyleStrategy Corresponds to the QFont::StyleStrategy property | - |
595 | \value FontKerning Specifies whether the font has kerning turned on. | - |
596 | \value FontHintingPreference Controls the use of hinting according to values | - |
597 | of the QFont::HintingPreference enum. | - |
598 | | - |
599 | \omitvalue FirstFontProperty | - |
600 | \omitvalue LastFontProperty | - |
601 | | - |
602 | \value TextUnderlineColor | - |
603 | \value TextVerticalAlignment | - |
604 | \value TextOutline | - |
605 | \value TextUnderlineStyle | - |
606 | \value TextToolTip Specifies the (optional) tool tip to be displayed for a fragment of text. | - |
607 | | - |
608 | \value IsAnchor | - |
609 | \value AnchorHref | - |
610 | \value AnchorName | - |
611 | \value ObjectType | - |
612 | | - |
613 | List properties | - |
614 | | - |
615 | \value ListStyle Specifies the style used for the items in a list, | - |
616 | described by values of the QTextListFormat::Style enum. | - |
617 | \value ListIndent Specifies the amount of indentation used for a list. | - |
618 | \value ListNumberPrefix Defines the text which is prepended to item numbers in | - |
619 | numeric lists. | - |
620 | \value ListNumberSuffix Defines the text which is appended to item numbers in | - |
621 | numeric lists. | - |
622 | | - |
623 | Table and frame properties | - |
624 | | - |
625 | \value FrameBorder | - |
626 | \value FrameBorderBrush | - |
627 | \value FrameBorderStyle See the \l{QTextFrameFormat::BorderStyle}{BorderStyle} enum. | - |
628 | \value FrameBottomMargin | - |
629 | \value FrameHeight | - |
630 | \value FrameLeftMargin | - |
631 | \value FrameMargin | - |
632 | \value FramePadding | - |
633 | \value FrameRightMargin | - |
634 | \value FrameTopMargin | - |
635 | \value FrameWidth | - |
636 | \value TableCellSpacing | - |
637 | \value TableCellPadding | - |
638 | \value TableColumns | - |
639 | \value TableColumnWidthConstraints | - |
640 | \value TableHeaderRowCount | - |
641 | | - |
642 | Table cell properties | - |
643 | | - |
644 | \value TableCellRowSpan | - |
645 | \value TableCellColumnSpan | - |
646 | \value TableCellLeftPadding | - |
647 | \value TableCellRightPadding | - |
648 | \value TableCellTopPadding | - |
649 | \value TableCellBottomPadding | - |
650 | | - |
651 | Image properties | - |
652 | | - |
653 | \value ImageName | - |
654 | \value ImageWidth | - |
655 | \value ImageHeight | - |
656 | | - |
657 | Selection properties | - |
658 | | - |
659 | \value FullWidthSelection When set on the characterFormat of a selection, | - |
660 | the whole width of the text will be shown selected. | - |
661 | | - |
662 | Page break properties | - |
663 | | - |
664 | \value PageBreakPolicy Specifies how pages are broken. See the PageBreakFlag enum. | - |
665 | | - |
666 | \value UserProperty | - |
667 | | - |
668 | \sa property(), setProperty() | - |
669 | */ | - |
670 | | - |
671 | /*! | - |
672 | \enum QTextFormat::ObjectTypes | - |
673 | | - |
674 | This enum describes what kind of QTextObject this format is associated with. | - |
675 | | - |
676 | \value NoObject | - |
677 | \value ImageObject | - |
678 | \value TableObject | - |
679 | \value TableCellObject | - |
680 | \value UserObject The first object that can be used for application-specific purposes. | - |
681 | | - |
682 | \sa QTextObject, QTextTable, QTextObject::format() | - |
683 | */ | - |
684 | | - |
685 | /*! | - |
686 | \enum QTextFormat::PageBreakFlag | - |
687 | \since 4.2 | - |
688 | | - |
689 | This enum describes how page breaking is performed when printing. It maps to the | - |
690 | corresponding css properties. | - |
691 | | - |
692 | \value PageBreak_Auto The page break is determined automatically depending on the | - |
693 | available space on the current page | - |
694 | \value PageBreak_AlwaysBefore The page is always broken before the paragraph/table | - |
695 | \value PageBreak_AlwaysAfter A new page is always started after the paragraph/table | - |
696 | | - |
697 | \sa QTextBlockFormat::pageBreakPolicy(), QTextFrameFormat::pageBreakPolicy(), | - |
698 | PageBreakPolicy | - |
699 | */ | - |
700 | | - |
701 | /*! | - |
702 | \fn bool QTextFormat::isValid() const | - |
703 | | - |
704 | Returns true if the format is valid (i.e. is not | - |
705 | InvalidFormat); otherwise returns false. | - |
706 | */ | - |
707 | | - |
708 | /*! | - |
709 | \fn bool QTextFormat::isCharFormat() const | - |
710 | | - |
711 | Returns true if this text format is a \c CharFormat; otherwise | - |
712 | returns false. | - |
713 | */ | - |
714 | | - |
715 | | - |
716 | /*! | - |
717 | \fn bool QTextFormat::isBlockFormat() const | - |
718 | | - |
719 | Returns true if this text format is a \c BlockFormat; otherwise | - |
720 | returns false. | - |
721 | */ | - |
722 | | - |
723 | | - |
724 | /*! | - |
725 | \fn bool QTextFormat::isListFormat() const | - |
726 | | - |
727 | Returns true if this text format is a \c ListFormat; otherwise | - |
728 | returns false. | - |
729 | */ | - |
730 | | - |
731 | | - |
732 | /*! | - |
733 | \fn bool QTextFormat::isTableFormat() const | - |
734 | | - |
735 | Returns true if this text format is a \c TableFormat; otherwise | - |
736 | returns false. | - |
737 | */ | - |
738 | | - |
739 | | - |
740 | /*! | - |
741 | \fn bool QTextFormat::isFrameFormat() const | - |
742 | | - |
743 | Returns true if this text format is a \c FrameFormat; otherwise | - |
744 | returns false. | - |
745 | */ | - |
746 | | - |
747 | | - |
748 | /*! | - |
749 | \fn bool QTextFormat::isImageFormat() const | - |
750 | | - |
751 | Returns true if this text format is an image format; otherwise | - |
752 | returns false. | - |
753 | */ | - |
754 | | - |
755 | | - |
756 | /*! | - |
757 | \fn bool QTextFormat::isTableCellFormat() const | - |
758 | \since 4.4 | - |
759 | | - |
760 | Returns true if this text format is a \c TableCellFormat; otherwise | - |
761 | returns false. | - |
762 | */ | - |
763 | | - |
764 | | - |
765 | /*! | - |
766 | Creates a new text format with an \c InvalidFormat. | - |
767 | | - |
768 | \sa FormatType | - |
769 | */ | - |
770 | QTextFormat::QTextFormat() | - |
771 | : format_type(InvalidFormat) | - |
772 | { | - |
773 | } executed: } Execution Count:6334 | 6334 |
774 | | - |
775 | /*! | - |
776 | Creates a new text format of the given \a type. | - |
777 | | - |
778 | \sa FormatType | - |
779 | */ | - |
780 | QTextFormat::QTextFormat(int type) | - |
781 | : format_type(type) | - |
782 | { | - |
783 | } executed: } Execution Count:83438 | 83438 |
784 | | - |
785 | | - |
786 | /*! | - |
787 | \fn QTextFormat::QTextFormat(const QTextFormat &other) | - |
788 | | - |
789 | Creates a new text format with the same attributes as the \a other | - |
790 | text format. | - |
791 | */ | - |
792 | QTextFormat::QTextFormat(const QTextFormat &rhs) | - |
793 | : d(rhs.d), format_type(rhs.format_type) | - |
794 | { | - |
795 | } executed: } Execution Count:441665 | 441665 |
796 | | - |
797 | /*! | - |
798 | \fn QTextFormat &QTextFormat::operator=(const QTextFormat &other) | - |
799 | | - |
800 | Assigns the \a other text format to this text format, and returns a | - |
801 | reference to this text format. | - |
802 | */ | - |
803 | QTextFormat &QTextFormat::operator=(const QTextFormat &rhs) | - |
804 | { | - |
805 | d = rhs.d; executed (the execution status of this line is deduced): d = rhs.d; | - |
806 | format_type = rhs.format_type; executed (the execution status of this line is deduced): format_type = rhs.format_type; | - |
807 | return *this; executed: return *this; Execution Count:20716 | 20716 |
808 | } | - |
809 | | - |
810 | /*! | - |
811 | \fn void QTextFormat::swap(QTextFormat &other) | - |
812 | \since 5.0 | - |
813 | | - |
814 | Swaps this text format with \a other. This function is very fast | - |
815 | and never fails. | - |
816 | */ | - |
817 | | - |
818 | /*! | - |
819 | Destroys this text format. | - |
820 | */ | - |
821 | QTextFormat::~QTextFormat() | - |
822 | { | - |
823 | } | - |
824 | | - |
825 | | - |
826 | /*! | - |
827 | Returns the text format as a QVariant | - |
828 | */ | - |
829 | QTextFormat::operator QVariant() const | - |
830 | { | - |
831 | return QVariant(QVariant::TextFormat, this); executed: return QVariant(QVariant::TextFormat, this); Execution Count:2 | 2 |
832 | } | - |
833 | | - |
834 | /*! | - |
835 | Merges the \a other format with this format; where there are | - |
836 | conflicts the \a other format takes precedence. | - |
837 | */ | - |
838 | void QTextFormat::merge(const QTextFormat &other) | - |
839 | { | - |
840 | if (format_type != other.format_type) partially evaluated: format_type != other.format_type no Evaluation Count:0 | yes Evaluation Count:18394 |
| 0-18394 |
841 | return; | 0 |
842 | | - |
843 | if (!d) { evaluated: !d yes Evaluation Count:133 | yes Evaluation Count:18261 |
| 133-18261 |
844 | d = other.d; executed (the execution status of this line is deduced): d = other.d; | - |
845 | return; executed: return; Execution Count:133 | 133 |
846 | } | - |
847 | | - |
848 | if (!other.d) evaluated: !other.d yes Evaluation Count:13936 | yes Evaluation Count:4325 |
| 4325-13936 |
849 | return; executed: return; Execution Count:13936 | 13936 |
850 | | - |
851 | QTextFormatPrivate *d = this->d; executed (the execution status of this line is deduced): QTextFormatPrivate *d = this->d; | - |
852 | | - |
853 | const QVector<QTextFormatPrivate::Property> &otherProps = other.d->props; executed (the execution status of this line is deduced): const QVector<QTextFormatPrivate::Property> &otherProps = other.d->props; | - |
854 | d->props.reserve(d->props.size() + otherProps.size()); executed (the execution status of this line is deduced): d->props.reserve(d->props.size() + otherProps.size()); | - |
855 | for (int i = 0; i < otherProps.count(); ++i) { evaluated: i < otherProps.count() yes Evaluation Count:4735 | yes Evaluation Count:4325 |
| 4325-4735 |
856 | const QTextFormatPrivate::Property &p = otherProps.at(i); executed (the execution status of this line is deduced): const QTextFormatPrivate::Property &p = otherProps.at(i); | - |
857 | d->insertProperty(p.key, p.value); executed (the execution status of this line is deduced): d->insertProperty(p.key, p.value); | - |
858 | } executed: } Execution Count:4735 | 4735 |
859 | } executed: } Execution Count:4325 | 4325 |
860 | | - |
861 | /*! | - |
862 | Returns the type of this format. | - |
863 | | - |
864 | \sa FormatType | - |
865 | */ | - |
866 | int QTextFormat::type() const | - |
867 | { | - |
868 | return format_type; executed: return format_type; Execution Count:6246 | 6246 |
869 | } | - |
870 | | - |
871 | /*! | - |
872 | Returns this format as a block format. | - |
873 | */ | - |
874 | QTextBlockFormat QTextFormat::toBlockFormat() const | - |
875 | { | - |
876 | return QTextBlockFormat(*this); executed: return QTextBlockFormat(*this); Execution Count:34916 | 34916 |
877 | } | - |
878 | | - |
879 | /*! | - |
880 | Returns this format as a character format. | - |
881 | */ | - |
882 | QTextCharFormat QTextFormat::toCharFormat() const | - |
883 | { | - |
884 | return QTextCharFormat(*this); executed: return QTextCharFormat(*this); Execution Count:68718 | 68718 |
885 | } | - |
886 | | - |
887 | /*! | - |
888 | Returns this format as a list format. | - |
889 | */ | - |
890 | QTextListFormat QTextFormat::toListFormat() const | - |
891 | { | - |
892 | return QTextListFormat(*this); executed: return QTextListFormat(*this); Execution Count:87 | 87 |
893 | } | - |
894 | | - |
895 | /*! | - |
896 | Returns this format as a table format. | - |
897 | */ | - |
898 | QTextTableFormat QTextFormat::toTableFormat() const | - |
899 | { | - |
900 | return QTextTableFormat(*this); executed: return QTextTableFormat(*this); Execution Count:626 | 626 |
901 | } | - |
902 | | - |
903 | /*! | - |
904 | Returns this format as a frame format. | - |
905 | */ | - |
906 | QTextFrameFormat QTextFormat::toFrameFormat() const | - |
907 | { | - |
908 | return QTextFrameFormat(*this); executed: return QTextFrameFormat(*this); Execution Count:4663 | 4663 |
909 | } | - |
910 | | - |
911 | /*! | - |
912 | Returns this format as an image format. | - |
913 | */ | - |
914 | QTextImageFormat QTextFormat::toImageFormat() const | - |
915 | { | - |
916 | return QTextImageFormat(*this); executed: return QTextImageFormat(*this); Execution Count:32 | 32 |
917 | } | - |
918 | | - |
919 | /*! | - |
920 | \since 4.4 | - |
921 | | - |
922 | Returns this format as a table cell format. | - |
923 | */ | - |
924 | QTextTableCellFormat QTextFormat::toTableCellFormat() const | - |
925 | { | - |
926 | return QTextTableCellFormat(*this); executed: return QTextTableCellFormat(*this); Execution Count:217 | 217 |
927 | } | - |
928 | | - |
929 | /*! | - |
930 | Returns the value of the property specified by \a propertyId. If the | - |
931 | property isn't of QTextFormat::Bool type, false is returned instead. | - |
932 | | - |
933 | \sa setProperty(), intProperty(), doubleProperty(), stringProperty(), colorProperty(), | - |
934 | lengthProperty(), lengthVectorProperty(), Property | - |
935 | */ | - |
936 | bool QTextFormat::boolProperty(int propertyId) const | - |
937 | { | - |
938 | if (!d) evaluated: !d yes Evaluation Count:68271 | yes Evaluation Count:5730 |
| 5730-68271 |
939 | return false; executed: return false; Execution Count:68271 | 68271 |
940 | const QVariant prop = d->property(propertyId); executed (the execution status of this line is deduced): const QVariant prop = d->property(propertyId); | - |
941 | if (prop.userType() != QVariant::Bool) evaluated: prop.userType() != QVariant::Bool yes Evaluation Count:5509 | yes Evaluation Count:221 |
| 221-5509 |
942 | return false; executed: return false; Execution Count:5509 | 5509 |
943 | return prop.toBool(); executed: return prop.toBool(); Execution Count:221 | 221 |
944 | } | - |
945 | | - |
946 | /*! | - |
947 | Returns the value of the property specified by \a propertyId. If the | - |
948 | property is not of QTextFormat::Integer type, 0 is returned instead. | - |
949 | | - |
950 | \sa setProperty(), boolProperty(), doubleProperty(), stringProperty(), colorProperty(), | - |
951 | lengthProperty(), lengthVectorProperty(), Property | - |
952 | */ | - |
953 | int QTextFormat::intProperty(int propertyId) const | - |
954 | { | - |
955 | // required, since the default layout direction has to be LayoutDirectionAuto, which is not integer 0 | - |
956 | int def = (propertyId == QTextFormat::LayoutDirection) ? int(Qt::LayoutDirectionAuto) : 0; evaluated: (propertyId == QTextFormat::LayoutDirection) yes Evaluation Count:7511 | yes Evaluation Count:123036 |
| 7511-123036 |
957 | | - |
958 | if (!d) evaluated: !d yes Evaluation Count:21 | yes Evaluation Count:130526 |
| 21-130526 |
959 | return def; executed: return def; Execution Count:21 | 21 |
960 | const QVariant prop = d->property(propertyId); executed (the execution status of this line is deduced): const QVariant prop = d->property(propertyId); | - |
961 | if (prop.userType() != QVariant::Int) evaluated: prop.userType() != QVariant::Int yes Evaluation Count:127891 | yes Evaluation Count:2635 |
| 2635-127891 |
962 | return def; executed: return def; Execution Count:127891 | 127891 |
963 | return prop.toInt(); executed: return prop.toInt(); Execution Count:2635 | 2635 |
964 | } | - |
965 | | - |
966 | /*! | - |
967 | Returns the value of the property specified by \a propertyId. If the | - |
968 | property isn't of QVariant::Double or QMetaType::Float type, 0 is | - |
969 | returned instead. | - |
970 | | - |
971 | \sa setProperty(), boolProperty(), intProperty(), stringProperty(), colorProperty(), | - |
972 | lengthProperty(), lengthVectorProperty(), Property | - |
973 | */ | - |
974 | qreal QTextFormat::doubleProperty(int propertyId) const | - |
975 | { | - |
976 | if (!d) evaluated: !d yes Evaluation Count:240 | yes Evaluation Count:29324 |
| 240-29324 |
977 | return 0.; executed: return 0.; Execution Count:240 | 240 |
978 | const QVariant prop = d->property(propertyId); executed (the execution status of this line is deduced): const QVariant prop = d->property(propertyId); | - |
979 | if (prop.userType() != QVariant::Double && prop.userType() != QMetaType::Float) evaluated: prop.userType() != QVariant::Double yes Evaluation Count:19071 | yes Evaluation Count:10253 |
partially evaluated: prop.userType() != QMetaType::Float yes Evaluation Count:19071 | no Evaluation Count:0 |
| 0-19071 |
980 | return 0.; executed: return 0.; Execution Count:19071 | 19071 |
981 | return qvariant_cast<qreal>(prop); executed: return qvariant_cast<qreal>(prop); Execution Count:10253 | 10253 |
982 | } | - |
983 | | - |
984 | /*! | - |
985 | Returns the value of the property given by \a propertyId; if the | - |
986 | property isn't of QVariant::String type, an empty string is | - |
987 | returned instead. | - |
988 | | - |
989 | \sa setProperty(), boolProperty(), intProperty(), doubleProperty(), colorProperty(), | - |
990 | lengthProperty(), lengthVectorProperty(), Property | - |
991 | */ | - |
992 | QString QTextFormat::stringProperty(int propertyId) const | - |
993 | { | - |
994 | if (!d) evaluated: !d yes Evaluation Count:1 | yes Evaluation Count:274 |
| 1-274 |
995 | return QString(); executed: return QString(); Execution Count:1 | 1 |
996 | const QVariant prop = d->property(propertyId); executed (the execution status of this line is deduced): const QVariant prop = d->property(propertyId); | - |
997 | if (prop.userType() != QVariant::String) evaluated: prop.userType() != QVariant::String yes Evaluation Count:102 | yes Evaluation Count:172 |
| 102-172 |
998 | return QString(); executed: return QString(); Execution Count:102 | 102 |
999 | return prop.toString(); executed: return prop.toString(); Execution Count:172 | 172 |
1000 | } | - |
1001 | | - |
1002 | /*! | - |
1003 | Returns the value of the property given by \a propertyId; if the | - |
1004 | property isn't of QVariant::Color type, an invalid color is | - |
1005 | returned instead. | - |
1006 | | - |
1007 | \sa setProperty(), boolProperty(), intProperty(), doubleProperty(), | - |
1008 | stringProperty(), lengthProperty(), lengthVectorProperty(), Property | - |
1009 | */ | - |
1010 | QColor QTextFormat::colorProperty(int propertyId) const | - |
1011 | { | - |
1012 | if (!d) evaluated: !d yes Evaluation Count:523 | yes Evaluation Count:17 |
| 17-523 |
1013 | return QColor(); executed: return QColor(); Execution Count:523 | 523 |
1014 | const QVariant prop = d->property(propertyId); executed (the execution status of this line is deduced): const QVariant prop = d->property(propertyId); | - |
1015 | if (prop.userType() != QVariant::Color) partially evaluated: prop.userType() != QVariant::Color yes Evaluation Count:17 | no Evaluation Count:0 |
| 0-17 |
1016 | return QColor(); executed: return QColor(); Execution Count:17 | 17 |
1017 | return qvariant_cast<QColor>(prop); never executed: return qvariant_cast<QColor>(prop); | 0 |
1018 | } | - |
1019 | | - |
1020 | /*! | - |
1021 | Returns the value of the property given by \a propertyId; if the | - |
1022 | property isn't of QVariant::Pen type, Qt::NoPen is | - |
1023 | returned instead. | - |
1024 | | - |
1025 | \sa setProperty(), boolProperty(), intProperty(), doubleProperty(), stringProperty(), | - |
1026 | lengthProperty(), lengthVectorProperty(), Property | - |
1027 | */ | - |
1028 | QPen QTextFormat::penProperty(int propertyId) const | - |
1029 | { | - |
1030 | if (!d) evaluated: !d yes Evaluation Count:17293 | yes Evaluation Count:417 |
| 417-17293 |
1031 | return QPen(Qt::NoPen); executed: return QPen(Qt::NoPen); Execution Count:17293 | 17293 |
1032 | const QVariant prop = d->property(propertyId); executed (the execution status of this line is deduced): const QVariant prop = d->property(propertyId); | - |
1033 | if (prop.userType() != QVariant::Pen) partially evaluated: prop.userType() != QVariant::Pen yes Evaluation Count:417 | no Evaluation Count:0 |
| 0-417 |
1034 | return QPen(Qt::NoPen); executed: return QPen(Qt::NoPen); Execution Count:417 | 417 |
1035 | return qvariant_cast<QPen>(prop); never executed: return qvariant_cast<QPen>(prop); | 0 |
1036 | } | - |
1037 | | - |
1038 | /*! | - |
1039 | Returns the value of the property given by \a propertyId; if the | - |
1040 | property isn't of QVariant::Brush type, Qt::NoBrush is | - |
1041 | returned instead. | - |
1042 | | - |
1043 | \sa setProperty(), boolProperty(), intProperty(), doubleProperty(), stringProperty(), | - |
1044 | lengthProperty(), lengthVectorProperty(), Property | - |
1045 | */ | - |
1046 | QBrush QTextFormat::brushProperty(int propertyId) const | - |
1047 | { | - |
1048 | if (!d) evaluated: !d yes Evaluation Count:712 | yes Evaluation Count:8438 |
| 712-8438 |
1049 | return QBrush(Qt::NoBrush); executed: return QBrush(Qt::NoBrush); Execution Count:712 | 712 |
1050 | const QVariant prop = d->property(propertyId); executed (the execution status of this line is deduced): const QVariant prop = d->property(propertyId); | - |
1051 | if (prop.userType() != QVariant::Brush) evaluated: prop.userType() != QVariant::Brush yes Evaluation Count:2284 | yes Evaluation Count:6154 |
| 2284-6154 |
1052 | return QBrush(Qt::NoBrush); executed: return QBrush(Qt::NoBrush); Execution Count:2284 | 2284 |
1053 | return qvariant_cast<QBrush>(prop); executed: return qvariant_cast<QBrush>(prop); Execution Count:6154 | 6154 |
1054 | } | - |
1055 | | - |
1056 | /*! | - |
1057 | Returns the value of the property given by \a propertyId. | - |
1058 | | - |
1059 | \sa setProperty(), boolProperty(), intProperty(), doubleProperty(), stringProperty(), | - |
1060 | colorProperty(), lengthVectorProperty(), Property | - |
1061 | */ | - |
1062 | QTextLength QTextFormat::lengthProperty(int propertyId) const | - |
1063 | { | - |
1064 | if (!d) partially evaluated: !d no Evaluation Count:0 | yes Evaluation Count:7922 |
| 0-7922 |
1065 | return QTextLength(); never executed: return QTextLength(); | 0 |
1066 | return qvariant_cast<QTextLength>(d->property(propertyId)); executed: return qvariant_cast<QTextLength>(d->property(propertyId)); Execution Count:7922 | 7922 |
1067 | } | - |
1068 | | - |
1069 | /*! | - |
1070 | Returns the value of the property given by \a propertyId. If the | - |
1071 | property isn't of QTextFormat::LengthVector type, an empty length | - |
1072 | vector is returned instead. | - |
1073 | | - |
1074 | \sa setProperty(), boolProperty(), intProperty(), doubleProperty(), stringProperty(), | - |
1075 | colorProperty(), lengthProperty(), Property | - |
1076 | */ | - |
1077 | QVector<QTextLength> QTextFormat::lengthVectorProperty(int propertyId) const | - |
1078 | { | - |
1079 | QVector<QTextLength> vector; executed (the execution status of this line is deduced): QVector<QTextLength> vector; | - |
1080 | if (!d) partially evaluated: !d no Evaluation Count:0 | yes Evaluation Count:79 |
| 0-79 |
1081 | return vector; never executed: return vector; | 0 |
1082 | const QVariant prop = d->property(propertyId); executed (the execution status of this line is deduced): const QVariant prop = d->property(propertyId); | - |
1083 | if (prop.userType() != QVariant::List) evaluated: prop.userType() != QVariant::List yes Evaluation Count:51 | yes Evaluation Count:28 |
| 28-51 |
1084 | return vector; executed: return vector; Execution Count:51 | 51 |
1085 | | - |
1086 | QList<QVariant> propertyList = prop.toList(); executed (the execution status of this line is deduced): QList<QVariant> propertyList = prop.toList(); | - |
1087 | for (int i=0; i<propertyList.size(); ++i) { evaluated: i<propertyList.size() yes Evaluation Count:24 | yes Evaluation Count:28 |
| 24-28 |
1088 | QVariant var = propertyList.at(i); executed (the execution status of this line is deduced): QVariant var = propertyList.at(i); | - |
1089 | if (var.userType() == QVariant::TextLength) partially evaluated: var.userType() == QVariant::TextLength yes Evaluation Count:24 | no Evaluation Count:0 |
| 0-24 |
1090 | vector.append(qvariant_cast<QTextLength>(var)); executed: vector.append(qvariant_cast<QTextLength>(var)); Execution Count:24 | 24 |
1091 | } executed: } Execution Count:24 | 24 |
1092 | | - |
1093 | return vector; executed: return vector; Execution Count:28 | 28 |
1094 | } | - |
1095 | | - |
1096 | /*! | - |
1097 | Returns the property specified by the given \a propertyId. | - |
1098 | | - |
1099 | \sa Property | - |
1100 | */ | - |
1101 | QVariant QTextFormat::property(int propertyId) const | - |
1102 | { | - |
1103 | return d ? d->property(propertyId) : QVariant(); executed: return d ? d->property(propertyId) : QVariant(); Execution Count:8730 | 8730 |
1104 | } | - |
1105 | | - |
1106 | /*! | - |
1107 | Sets the property specified by the \a propertyId to the given \a value. | - |
1108 | | - |
1109 | \sa Property | - |
1110 | */ | - |
1111 | void QTextFormat::setProperty(int propertyId, const QVariant &value) | - |
1112 | { | - |
1113 | if (!d) evaluated: !d yes Evaluation Count:18116 | yes Evaluation Count:292248 |
| 18116-292248 |
1114 | d = new QTextFormatPrivate; executed: d = new QTextFormatPrivate; Execution Count:18116 | 18116 |
1115 | if (!value.isValid()) partially evaluated: !value.isValid() no Evaluation Count:0 | yes Evaluation Count:310364 |
| 0-310364 |
1116 | clearProperty(propertyId); never executed: clearProperty(propertyId); | 0 |
1117 | else | - |
1118 | d->insertProperty(propertyId, value); executed: d->insertProperty(propertyId, value); Execution Count:310364 | 310364 |
1119 | } | - |
1120 | | - |
1121 | /*! | - |
1122 | Sets the value of the property given by \a propertyId to \a value. | - |
1123 | | - |
1124 | \sa lengthVectorProperty(), Property | - |
1125 | */ | - |
1126 | void QTextFormat::setProperty(int propertyId, const QVector<QTextLength> &value) | - |
1127 | { | - |
1128 | if (!d) partially evaluated: !d no Evaluation Count:0 | yes Evaluation Count:90 |
| 0-90 |
1129 | d = new QTextFormatPrivate; never executed: d = new QTextFormatPrivate; | 0 |
1130 | QVariantList list; executed (the execution status of this line is deduced): QVariantList list; | - |
1131 | for (int i=0; i<value.size(); ++i) evaluated: i<value.size() yes Evaluation Count:126 | yes Evaluation Count:90 |
| 90-126 |
1132 | list << value.at(i); executed: list << value.at(i); Execution Count:126 | 126 |
1133 | d->insertProperty(propertyId, list); executed (the execution status of this line is deduced): d->insertProperty(propertyId, list); | - |
1134 | } executed: } Execution Count:90 | 90 |
1135 | | - |
1136 | /*! | - |
1137 | Clears the value of the property given by \a propertyId | - |
1138 | | - |
1139 | \sa Property | - |
1140 | */ | - |
1141 | void QTextFormat::clearProperty(int propertyId) | - |
1142 | { | - |
1143 | if (!d) evaluated: !d yes Evaluation Count:6882 | yes Evaluation Count:50178 |
| 6882-50178 |
1144 | return; executed: return; Execution Count:6882 | 6882 |
1145 | d->clearProperty(propertyId); executed (the execution status of this line is deduced): d->clearProperty(propertyId); | - |
1146 | } executed: } Execution Count:50178 | 50178 |
1147 | | - |
1148 | | - |
1149 | /*! | - |
1150 | \fn void QTextFormat::setObjectType(int type) | - |
1151 | | - |
1152 | Sets the text format's object type to \a type. | - |
1153 | | - |
1154 | \sa ObjectTypes, objectType() | - |
1155 | */ | - |
1156 | | - |
1157 | | - |
1158 | /*! | - |
1159 | \fn int QTextFormat::objectType() const | - |
1160 | | - |
1161 | Returns the text format's object type. | - |
1162 | | - |
1163 | \sa ObjectTypes, setObjectType() | - |
1164 | */ | - |
1165 | | - |
1166 | | - |
1167 | /*! | - |
1168 | Returns the index of the format object, or -1 if the format object is invalid. | - |
1169 | | - |
1170 | \sa setObjectIndex() | - |
1171 | */ | - |
1172 | int QTextFormat::objectIndex() const | - |
1173 | { | - |
1174 | if (!d) evaluated: !d yes Evaluation Count:116 | yes Evaluation Count:89012 |
| 116-89012 |
1175 | return -1; executed: return -1; Execution Count:116 | 116 |
1176 | const QVariant prop = d->property(ObjectIndex); executed (the execution status of this line is deduced): const QVariant prop = d->property(ObjectIndex); | - |
1177 | if (prop.userType() != QVariant::Int) // #### evaluated: prop.userType() != QVariant::Int yes Evaluation Count:70289 | yes Evaluation Count:18723 |
| 18723-70289 |
1178 | return -1; executed: return -1; Execution Count:70289 | 70289 |
1179 | return prop.toInt(); executed: return prop.toInt(); Execution Count:18723 | 18723 |
1180 | } | - |
1181 | | - |
1182 | /*! | - |
1183 | \fn void QTextFormat::setObjectIndex(int index) | - |
1184 | | - |
1185 | Sets the format object's object \a index. | - |
1186 | | - |
1187 | \sa objectIndex() | - |
1188 | */ | - |
1189 | void QTextFormat::setObjectIndex(int o) | - |
1190 | { | - |
1191 | if (o == -1) { evaluated: o == -1 yes Evaluation Count:4 | yes Evaluation Count:866 |
| 4-866 |
1192 | if (d) partially evaluated: d yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
1193 | d->clearProperty(ObjectIndex); executed: d->clearProperty(ObjectIndex); Execution Count:4 | 4 |
1194 | } else { executed: } Execution Count:4 | 4 |
1195 | if (!d) evaluated: !d yes Evaluation Count:231 | yes Evaluation Count:635 |
| 231-635 |
1196 | d = new QTextFormatPrivate; executed: d = new QTextFormatPrivate; Execution Count:231 | 231 |
1197 | // ### type | - |
1198 | d->insertProperty(ObjectIndex, o); executed (the execution status of this line is deduced): d->insertProperty(ObjectIndex, o); | - |
1199 | } executed: } Execution Count:866 | 866 |
1200 | } | - |
1201 | | - |
1202 | /*! | - |
1203 | Returns true if the text format has a property with the given \a | - |
1204 | propertyId; otherwise returns false. | - |
1205 | | - |
1206 | \sa properties(), Property | - |
1207 | */ | - |
1208 | bool QTextFormat::hasProperty(int propertyId) const | - |
1209 | { | - |
1210 | return d ? d->hasProperty(propertyId) : false; executed: return d ? d->hasProperty(propertyId) : false; Execution Count:48369 | 48369 |
1211 | } | - |
1212 | | - |
1213 | /* | - |
1214 | Returns the property type for the given \a propertyId. | - |
1215 | | - |
1216 | \sa hasProperty(), allPropertyIds(), Property | - |
1217 | */ | - |
1218 | | - |
1219 | /*! | - |
1220 | Returns a map with all properties of this text format. | - |
1221 | */ | - |
1222 | QMap<int, QVariant> QTextFormat::properties() const | - |
1223 | { | - |
1224 | QMap<int, QVariant> map; executed (the execution status of this line is deduced): QMap<int, QVariant> map; | - |
1225 | if (d) { evaluated: d yes Evaluation Count:183 | yes Evaluation Count:86 |
| 86-183 |
1226 | for (int i = 0; i < d->props.count(); ++i) evaluated: i < d->props.count() yes Evaluation Count:6 | yes Evaluation Count:183 |
| 6-183 |
1227 | map.insert(d->props.at(i).key, d->props.at(i).value); executed: map.insert(d->props.at(i).key, d->props.at(i).value); Execution Count:6 | 6 |
1228 | } executed: } Execution Count:183 | 183 |
1229 | return map; executed: return map; Execution Count:269 | 269 |
1230 | } | - |
1231 | | - |
1232 | /*! | - |
1233 | \since 4.3 | - |
1234 | Returns the number of properties stored in the format. | - |
1235 | */ | - |
1236 | int QTextFormat::propertyCount() const | - |
1237 | { | - |
1238 | return d ? d->props.count() : 0; executed: return d ? d->props.count() : 0; Execution Count:1708 | 1708 |
1239 | } | - |
1240 | | - |
1241 | /*! | - |
1242 | \fn bool QTextFormat::operator!=(const QTextFormat &other) const | - |
1243 | | - |
1244 | Returns true if this text format is different from the \a other text | - |
1245 | format. | - |
1246 | */ | - |
1247 | | - |
1248 | | - |
1249 | /*! | - |
1250 | \fn bool QTextFormat::operator==(const QTextFormat &other) const | - |
1251 | | - |
1252 | Returns true if this text format is the same as the \a other text | - |
1253 | format. | - |
1254 | */ | - |
1255 | bool QTextFormat::operator==(const QTextFormat &rhs) const | - |
1256 | { | - |
1257 | if (format_type != rhs.format_type) evaluated: format_type != rhs.format_type yes Evaluation Count:3208 | yes Evaluation Count:44108 |
| 3208-44108 |
1258 | return false; executed: return false; Execution Count:3208 | 3208 |
1259 | | - |
1260 | if (d == rhs.d) evaluated: d == rhs.d yes Evaluation Count:16553 | yes Evaluation Count:27555 |
| 16553-27555 |
1261 | return true; executed: return true; Execution Count:16553 | 16553 |
1262 | | - |
1263 | if (d && d->props.isEmpty() && !rhs.d) evaluated: d yes Evaluation Count:27515 | yes Evaluation Count:40 |
evaluated: d->props.isEmpty() yes Evaluation Count:25578 | yes Evaluation Count:1937 |
evaluated: !rhs.d yes Evaluation Count:5930 | yes Evaluation Count:19648 |
| 40-27515 |
1264 | return true; executed: return true; Execution Count:5930 | 5930 |
1265 | | - |
1266 | if (!d && rhs.d && rhs.d->props.isEmpty()) evaluated: !d yes Evaluation Count:40 | yes Evaluation Count:21585 |
partially evaluated: rhs.d yes Evaluation Count:40 | no Evaluation Count:0 |
partially evaluated: rhs.d->props.isEmpty() no Evaluation Count:0 | yes Evaluation Count:40 |
| 0-21585 |
1267 | return true; never executed: return true; | 0 |
1268 | | - |
1269 | if (!d || !rhs.d) evaluated: !d yes Evaluation Count:40 | yes Evaluation Count:21585 |
evaluated: !rhs.d yes Evaluation Count:32 | yes Evaluation Count:21553 |
| 32-21585 |
1270 | return false; executed: return false; Execution Count:72 | 72 |
1271 | | - |
1272 | return *d == *rhs.d; executed: return *d == *rhs.d; Execution Count:21553 | 21553 |
1273 | } | - |
1274 | | - |
1275 | /*! | - |
1276 | \class QTextCharFormat | - |
1277 | \reentrant | - |
1278 | | - |
1279 | \brief The QTextCharFormat class provides formatting information for | - |
1280 | characters in a QTextDocument. | - |
1281 | \inmodule QtGui | - |
1282 | | - |
1283 | \ingroup richtext-processing | - |
1284 | \ingroup shared | - |
1285 | | - |
1286 | The character format of text in a document specifies the visual properties | - |
1287 | of the text, as well as information about its role in a hypertext document. | - |
1288 | | - |
1289 | The font used can be set by supplying a font to the setFont() function, and | - |
1290 | each aspect of its appearance can be adjusted to give the desired effect. | - |
1291 | setFontFamily() and setFontPointSize() define the font's family (e.g. Times) | - |
1292 | and printed size; setFontWeight() and setFontItalic() provide control over | - |
1293 | the style of the font. setFontUnderline(), setFontOverline(), | - |
1294 | setFontStrikeOut(), and setFontFixedPitch() provide additional effects for | - |
1295 | text. | - |
1296 | | - |
1297 | The color is set with setForeground(). If the text is intended to be used | - |
1298 | as an anchor (for hyperlinks), this can be enabled with setAnchor(). The | - |
1299 | setAnchorHref() and setAnchorNames() functions are used to specify the | - |
1300 | information about the hyperlink's destination and the anchor's name. | - |
1301 | | - |
1302 | \sa QTextFormat, QTextBlockFormat, QTextTableFormat, QTextListFormat | - |
1303 | */ | - |
1304 | | - |
1305 | /*! | - |
1306 | \enum QTextCharFormat::VerticalAlignment | - |
1307 | | - |
1308 | This enum describes the ways that adjacent characters can be vertically | - |
1309 | aligned. | - |
1310 | | - |
1311 | \value AlignNormal Adjacent characters are positioned in the standard | - |
1312 | way for text in the writing system in use. | - |
1313 | \value AlignSuperScript Characters are placed above the base line for | - |
1314 | normal text. | - |
1315 | \value AlignSubScript Characters are placed below the base line for | - |
1316 | normal text. | - |
1317 | \value AlignMiddle The center of the object is vertically aligned with the | - |
1318 | base line. Currently, this is only implemented for | - |
1319 | inline objects. | - |
1320 | \value AlignBottom The bottom edge of the object is vertically aligned with | - |
1321 | the base line. | - |
1322 | \value AlignTop The top edge of the object is vertically aligned with | - |
1323 | the base line. | - |
1324 | \value AlignBaseline The base lines of the characters are aligned. | - |
1325 | */ | - |
1326 | | - |
1327 | /*! | - |
1328 | \enum QTextCharFormat::UnderlineStyle | - |
1329 | | - |
1330 | This enum describes the different ways drawing underlined text. | - |
1331 | | - |
1332 | \value NoUnderline Text is draw without any underlining decoration. | - |
1333 | \value SingleUnderline A line is drawn using Qt::SolidLine. | - |
1334 | \value DashUnderline Dashes are drawn using Qt::DashLine. | - |
1335 | \value DotLine Dots are drawn using Qt::DotLine; | - |
1336 | \value DashDotLine Dashs and dots are drawn using Qt::DashDotLine. | - |
1337 | \value DashDotDotLine Underlines draw drawn using Qt::DashDotDotLine. | - |
1338 | \value WaveUnderline The text is underlined using a wave shaped line. | - |
1339 | \value SpellCheckUnderline The underline is drawn depending on the QStyle::SH_SpellCeckUnderlineStyle | - |
1340 | style hint of the QApplication style. By default this is mapped to | - |
1341 | WaveUnderline, on Mac OS X it is mapped to DashDotLine. | - |
1342 | | - |
1343 | \sa Qt::PenStyle | - |
1344 | */ | - |
1345 | | - |
1346 | /*! | - |
1347 | \fn QTextCharFormat::QTextCharFormat() | - |
1348 | | - |
1349 | Constructs a new character format object. | - |
1350 | */ | - |
1351 | QTextCharFormat::QTextCharFormat() : QTextFormat(CharFormat) {} executed: } Execution Count:73697 | 73697 |
1352 | | - |
1353 | /*! | - |
1354 | \internal | - |
1355 | \fn QTextCharFormat::QTextCharFormat(const QTextFormat &other) | - |
1356 | | - |
1357 | Creates a new character format with the same attributes as the \a given | - |
1358 | text format. | - |
1359 | */ | - |
1360 | QTextCharFormat::QTextCharFormat(const QTextFormat &fmt) | - |
1361 | : QTextFormat(fmt) | - |
1362 | { | - |
1363 | } executed: } Execution Count:68967 | 68967 |
1364 | | - |
1365 | /*! | - |
1366 | \fn bool QTextCharFormat::isValid() const | - |
1367 | | - |
1368 | Returns true if this character format is valid; otherwise returns | - |
1369 | false. | - |
1370 | */ | - |
1371 | | - |
1372 | | - |
1373 | /*! | - |
1374 | \fn void QTextCharFormat::setFontFamily(const QString &family) | - |
1375 | | - |
1376 | Sets the text format's font \a family. | - |
1377 | | - |
1378 | \sa setFont() | - |
1379 | */ | - |
1380 | | - |
1381 | | - |
1382 | /*! | - |
1383 | \fn QString QTextCharFormat::fontFamily() const | - |
1384 | | - |
1385 | Returns the text format's font family. | - |
1386 | | - |
1387 | \sa font() | - |
1388 | */ | - |
1389 | | - |
1390 | | - |
1391 | /*! | - |
1392 | \fn void QTextCharFormat::setFontPointSize(qreal size) | - |
1393 | | - |
1394 | Sets the text format's font \a size. | - |
1395 | | - |
1396 | \sa setFont() | - |
1397 | */ | - |
1398 | | - |
1399 | | - |
1400 | /*! | - |
1401 | \fn qreal QTextCharFormat::fontPointSize() const | - |
1402 | | - |
1403 | Returns the font size used to display text in this format. | - |
1404 | | - |
1405 | \sa font() | - |
1406 | */ | - |
1407 | | - |
1408 | | - |
1409 | /*! | - |
1410 | \fn void QTextCharFormat::setFontWeight(int weight) | - |
1411 | | - |
1412 | Sets the text format's font weight to \a weight. | - |
1413 | | - |
1414 | \sa setFont(), QFont::Weight | - |
1415 | */ | - |
1416 | | - |
1417 | | - |
1418 | /*! | - |
1419 | \fn int QTextCharFormat::fontWeight() const | - |
1420 | | - |
1421 | Returns the text format's font weight. | - |
1422 | | - |
1423 | \sa font(), QFont::Weight | - |
1424 | */ | - |
1425 | | - |
1426 | | - |
1427 | /*! | - |
1428 | \fn void QTextCharFormat::setFontItalic(bool italic) | - |
1429 | | - |
1430 | If \a italic is true, sets the text format's font to be italic; otherwise | - |
1431 | the font will be non-italic. | - |
1432 | | - |
1433 | \sa setFont() | - |
1434 | */ | - |
1435 | | - |
1436 | | - |
1437 | /*! | - |
1438 | \fn bool QTextCharFormat::fontItalic() const | - |
1439 | | - |
1440 | Returns true if the text format's font is italic; otherwise | - |
1441 | returns false. | - |
1442 | | - |
1443 | \sa font() | - |
1444 | */ | - |
1445 | | - |
1446 | | - |
1447 | /*! | - |
1448 | \fn void QTextCharFormat::setFontUnderline(bool underline) | - |
1449 | | - |
1450 | If \a underline is true, sets the text format's font to be underlined; | - |
1451 | otherwise it is displayed non-underlined. | - |
1452 | | - |
1453 | \sa setFont() | - |
1454 | */ | - |
1455 | | - |
1456 | | - |
1457 | /*! | - |
1458 | \fn bool QTextCharFormat::fontUnderline() const | - |
1459 | | - |
1460 | Returns true if the text format's font is underlined; otherwise | - |
1461 | returns false. | - |
1462 | | - |
1463 | \sa font() | - |
1464 | */ | - |
1465 | bool QTextCharFormat::fontUnderline() const | - |
1466 | { | - |
1467 | if (hasProperty(TextUnderlineStyle)) evaluated: hasProperty(TextUnderlineStyle) yes Evaluation Count:17 | yes Evaluation Count:8 |
| 8-17 |
1468 | return underlineStyle() == SingleUnderline; executed: return underlineStyle() == SingleUnderline; Execution Count:17 | 17 |
1469 | return boolProperty(FontUnderline); executed: return boolProperty(FontUnderline); Execution Count:8 | 8 |
1470 | } | - |
1471 | | - |
1472 | /*! | - |
1473 | \fn UnderlineStyle QTextCharFormat::underlineStyle() const | - |
1474 | \since 4.2 | - |
1475 | | - |
1476 | Returns the style of underlining the text. | - |
1477 | */ | - |
1478 | | - |
1479 | /*! | - |
1480 | \fn void QTextCharFormat::setUnderlineStyle(UnderlineStyle style) | - |
1481 | \since 4.2 | - |
1482 | | - |
1483 | Sets the style of underlining the text to \a style. | - |
1484 | */ | - |
1485 | void QTextCharFormat::setUnderlineStyle(UnderlineStyle style) | - |
1486 | { | - |
1487 | setProperty(TextUnderlineStyle, style); executed (the execution status of this line is deduced): setProperty(TextUnderlineStyle, style); | - |
1488 | // for compatibility | - |
1489 | setProperty(FontUnderline, style == SingleUnderline); executed (the execution status of this line is deduced): setProperty(FontUnderline, style == SingleUnderline); | - |
1490 | } executed: } Execution Count:14064 | 14064 |
1491 | | - |
1492 | /*! | - |
1493 | \fn void QTextCharFormat::setFontOverline(bool overline) | - |
1494 | | - |
1495 | If \a overline is true, sets the text format's font to be overlined; | - |
1496 | otherwise the font is displayed non-overlined. | - |
1497 | | - |
1498 | \sa setFont() | - |
1499 | */ | - |
1500 | | - |
1501 | | - |
1502 | /*! | - |
1503 | \fn bool QTextCharFormat::fontOverline() const | - |
1504 | | - |
1505 | Returns true if the text format's font is overlined; otherwise | - |
1506 | returns false. | - |
1507 | | - |
1508 | \sa font() | - |
1509 | */ | - |
1510 | | - |
1511 | | - |
1512 | /*! | - |
1513 | \fn void QTextCharFormat::setFontStrikeOut(bool strikeOut) | - |
1514 | | - |
1515 | If \a strikeOut is true, sets the text format's font with strike-out | - |
1516 | enabled (with a horizontal line through it); otherwise it is displayed | - |
1517 | without strikeout. | - |
1518 | | - |
1519 | \sa setFont() | - |
1520 | */ | - |
1521 | | - |
1522 | | - |
1523 | /*! | - |
1524 | \fn bool QTextCharFormat::fontStrikeOut() const | - |
1525 | | - |
1526 | Returns true if the text format's font is struck out (has a horizontal line | - |
1527 | drawn through it); otherwise returns false. | - |
1528 | | - |
1529 | \sa font() | - |
1530 | */ | - |
1531 | | - |
1532 | | - |
1533 | /*! | - |
1534 | \since 4.5 | - |
1535 | \fn void QTextCharFormat::setFontStyleHint(QFont::StyleHint hint, QFont::StyleStrategy strategy) | - |
1536 | | - |
1537 | Sets the font style \a hint and \a strategy. | - |
1538 | | - |
1539 | Qt does not support style hints on X11 since this information is not provided by the window system. | - |
1540 | | - |
1541 | \sa setFont() | - |
1542 | \sa QFont::setStyleHint() | - |
1543 | */ | - |
1544 | | - |
1545 | | - |
1546 | /*! | - |
1547 | \since 4.5 | - |
1548 | \fn void QTextCharFormat::setFontStyleStrategy(QFont::StyleStrategy strategy) | - |
1549 | | - |
1550 | Sets the font style \a strategy. | - |
1551 | | - |
1552 | \sa setFont() | - |
1553 | \sa QFont::setStyleStrategy() | - |
1554 | */ | - |
1555 | | - |
1556 | | - |
1557 | /*! | - |
1558 | \since 4.5 | - |
1559 | \fn void QTextCharFormat::setFontKerning(bool enable) | - |
1560 | Enables kerning for this font if \a enable is true; otherwise disables it. | - |
1561 | | - |
1562 | When kerning is enabled, glyph metrics do not add up anymore, even for | - |
1563 | Latin text. In other words, the assumption that width('a') + width('b') | - |
1564 | is equal to width("ab") is not neccesairly true. | - |
1565 | | - |
1566 | \sa setFont() | - |
1567 | */ | - |
1568 | | - |
1569 | | - |
1570 | /*! | - |
1571 | \fn QTextCharFormat::StyleHint QTextCharFormat::fontStyleHint() const | - |
1572 | \since 4.5 | - |
1573 | | - |
1574 | Returns the font style hint. | - |
1575 | | - |
1576 | \sa setFontStyleHint(), font() | - |
1577 | */ | - |
1578 | | - |
1579 | | - |
1580 | /*! | - |
1581 | \since 4.5 | - |
1582 | \fn QTextCharFormat::StyleStrategy QTextCharFormat::fontStyleStrategy() const | - |
1583 | | - |
1584 | Returns the current font style strategy. | - |
1585 | | - |
1586 | \sa setFontStyleStrategy() | - |
1587 | \sa font() | - |
1588 | */ | - |
1589 | | - |
1590 | | - |
1591 | /*! | - |
1592 | \since 4.5 | - |
1593 | \fn bool QTextCharFormat::fontKerning() const | - |
1594 | Returns true if the font kerning is enabled. | - |
1595 | | - |
1596 | \sa setFontKerning() | - |
1597 | \sa font() | - |
1598 | */ | - |
1599 | | - |
1600 | | - |
1601 | /*! | - |
1602 | \fn void QTextCharFormat::setFontFixedPitch(bool fixedPitch) | - |
1603 | | - |
1604 | If \a fixedPitch is true, sets the text format's font to be fixed pitch; | - |
1605 | otherwise a non-fixed pitch font is used. | - |
1606 | | - |
1607 | \sa setFont() | - |
1608 | */ | - |
1609 | | - |
1610 | | - |
1611 | /*! | - |
1612 | \fn bool QTextCharFormat::fontFixedPitch() const | - |
1613 | | - |
1614 | Returns true if the text format's font is fixed pitch; otherwise | - |
1615 | returns false. | - |
1616 | | - |
1617 | \sa font() | - |
1618 | */ | - |
1619 | | - |
1620 | /*! | - |
1621 | \since 4.8 | - |
1622 | | - |
1623 | \fn void QTextCharFormat::setFontHintingPreference(QFont::HintingPreference hintingPreference) | - |
1624 | | - |
1625 | Sets the hinting preference of the text format's font to be \a hintingPreference. | - |
1626 | | - |
1627 | \sa setFont(), QFont::setHintingPreference() | - |
1628 | */ | - |
1629 | | - |
1630 | /*! | - |
1631 | \since 4.8 | - |
1632 | | - |
1633 | \fn QFont::HintingPreference QTextCharFormat::fontHintingPreference() const | - |
1634 | | - |
1635 | Returns the hinting preference set for this text format. | - |
1636 | | - |
1637 | \sa font(), QFont::hintingPreference() | - |
1638 | */ | - |
1639 | | - |
1640 | /*! | - |
1641 | \fn QPen QTextCharFormat::textOutline() const | - |
1642 | | - |
1643 | Returns the pen used to draw the outlines of characters in this format. | - |
1644 | */ | - |
1645 | | - |
1646 | | - |
1647 | /*! | - |
1648 | \fn void QTextCharFormat::setTextOutline(const QPen &pen) | - |
1649 | | - |
1650 | Sets the pen used to draw the outlines of characters to the given \a pen. | - |
1651 | */ | - |
1652 | | - |
1653 | /*! | - |
1654 | \fn void QTextCharFormat::setToolTip(const QString &text) | - |
1655 | \since 4.3 | - |
1656 | | - |
1657 | Sets the tool tip for a fragment of text to the given \a text. | - |
1658 | */ | - |
1659 | | - |
1660 | /*! | - |
1661 | \fn QString QTextCharFormat::toolTip() const | - |
1662 | \since 4.3 | - |
1663 | | - |
1664 | Returns the tool tip that is displayed for a fragment of text. | - |
1665 | */ | - |
1666 | | - |
1667 | /*! | - |
1668 | \fn void QTextFormat::setForeground(const QBrush &brush) | - |
1669 | | - |
1670 | Sets the foreground brush to the specified \a brush. The foreground | - |
1671 | brush is mostly used to render text. | - |
1672 | | - |
1673 | \sa foreground(), clearForeground(), setBackground() | - |
1674 | */ | - |
1675 | | - |
1676 | | - |
1677 | /*! | - |
1678 | \fn QBrush QTextFormat::foreground() const | - |
1679 | | - |
1680 | Returns the brush used to render foreground details, such as text, | - |
1681 | frame outlines, and table borders. | - |
1682 | | - |
1683 | \sa setForeground(), clearForeground(), background() | - |
1684 | */ | - |
1685 | | - |
1686 | /*! | - |
1687 | \fn void QTextFormat::clearForeground() | - |
1688 | | - |
1689 | Clears the brush used to paint the document's foreground. The default | - |
1690 | brush will be used. | - |
1691 | | - |
1692 | \sa foreground(), setForeground(), clearBackground() | - |
1693 | */ | - |
1694 | | - |
1695 | | - |
1696 | /*! | - |
1697 | \fn void QTextCharFormat::setAnchor(bool anchor) | - |
1698 | | - |
1699 | If \a anchor is true, text with this format represents an anchor, and is | - |
1700 | formatted in the appropriate way; otherwise the text is formatted normally. | - |
1701 | (Anchors are hyperlinks which are often shown underlined and in a different | - |
1702 | color from plain text.) | - |
1703 | | - |
1704 | The way the text is rendered is independent of whether or not the format | - |
1705 | has a valid anchor defined. Use setAnchorHref(), and optionally | - |
1706 | setAnchorNames() to create a hypertext link. | - |
1707 | | - |
1708 | \sa isAnchor() | - |
1709 | */ | - |
1710 | | - |
1711 | | - |
1712 | /*! | - |
1713 | \fn bool QTextCharFormat::isAnchor() const | - |
1714 | | - |
1715 | Returns true if the text is formatted as an anchor; otherwise | - |
1716 | returns false. | - |
1717 | | - |
1718 | \sa setAnchor(), setAnchorHref(), setAnchorNames() | - |
1719 | */ | - |
1720 | | - |
1721 | | - |
1722 | /*! | - |
1723 | \fn void QTextCharFormat::setAnchorHref(const QString &value) | - |
1724 | | - |
1725 | Sets the hypertext link for the text format to the given \a value. | - |
1726 | This is typically a URL like "http://example.com/index.html". | - |
1727 | | - |
1728 | The anchor will be displayed with the \a value as its display text; | - |
1729 | if you want to display different text call setAnchorNames(). | - |
1730 | | - |
1731 | To format the text as a hypertext link use setAnchor(). | - |
1732 | */ | - |
1733 | | - |
1734 | | - |
1735 | /*! | - |
1736 | \fn QString QTextCharFormat::anchorHref() const | - |
1737 | | - |
1738 | Returns the text format's hypertext link, or an empty string if | - |
1739 | none has been set. | - |
1740 | */ | - |
1741 | | - |
1742 | | - |
1743 | /*! | - |
1744 | \fn void QTextCharFormat::setAnchorName(const QString &name) | - |
1745 | \obsolete | - |
1746 | | - |
1747 | This function is deprecated. Use setAnchorNames() instead. | - |
1748 | | - |
1749 | Sets the text format's anchor \a name. For the anchor to work as a | - |
1750 | hyperlink, the destination must be set with setAnchorHref() and | - |
1751 | the anchor must be enabled with setAnchor(). | - |
1752 | */ | - |
1753 | | - |
1754 | /*! | - |
1755 | \fn void QTextCharFormat::setAnchorNames(const QStringList &names) | - |
1756 | \since 4.3 | - |
1757 | | - |
1758 | Sets the text format's anchor \a names. For the anchor to work as a | - |
1759 | hyperlink, the destination must be set with setAnchorHref() and | - |
1760 | the anchor must be enabled with setAnchor(). | - |
1761 | */ | - |
1762 | | - |
1763 | /*! | - |
1764 | \fn QString QTextCharFormat::anchorName() const | - |
1765 | \obsolete | - |
1766 | | - |
1767 | This function is deprecated. Use anchorNames() instead. | - |
1768 | | - |
1769 | Returns the anchor name associated with this text format, or an empty | - |
1770 | string if none has been set. If the anchor name is set, text with this | - |
1771 | format can be the destination of a hypertext link. | - |
1772 | */ | - |
1773 | QString QTextCharFormat::anchorName() const | - |
1774 | { | - |
1775 | QVariant prop = property(AnchorName); executed (the execution status of this line is deduced): QVariant prop = property(AnchorName); | - |
1776 | if (prop.userType() == QVariant::StringList) evaluated: prop.userType() == QVariant::StringList yes Evaluation Count:54 | yes Evaluation Count:51 |
| 51-54 |
1777 | return prop.toStringList().value(0); executed: return prop.toStringList().value(0); Execution Count:54 | 54 |
1778 | else if (prop.userType() != QVariant::String) partially evaluated: prop.userType() != QVariant::String yes Evaluation Count:51 | no Evaluation Count:0 |
| 0-51 |
1779 | return QString(); executed: return QString(); Execution Count:51 | 51 |
1780 | return prop.toString(); never executed: return prop.toString(); | 0 |
1781 | } | - |
1782 | | - |
1783 | /*! | - |
1784 | \fn QStringList QTextCharFormat::anchorNames() const | - |
1785 | \since 4.3 | - |
1786 | | - |
1787 | Returns the anchor names associated with this text format, or an empty | - |
1788 | string list if none has been set. If the anchor names are set, text with this | - |
1789 | format can be the destination of a hypertext link. | - |
1790 | */ | - |
1791 | QStringList QTextCharFormat::anchorNames() const | - |
1792 | { | - |
1793 | QVariant prop = property(AnchorName); executed (the execution status of this line is deduced): QVariant prop = property(AnchorName); | - |
1794 | if (prop.userType() == QVariant::StringList) evaluated: prop.userType() == QVariant::StringList yes Evaluation Count:10 | yes Evaluation Count:2 |
| 2-10 |
1795 | return prop.toStringList(); executed: return prop.toStringList(); Execution Count:10 | 10 |
1796 | else if (prop.userType() != QVariant::String) partially evaluated: prop.userType() != QVariant::String yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1797 | return QStringList(); executed: return QStringList(); Execution Count:2 | 2 |
1798 | return QStringList(prop.toString()); never executed: return QStringList(prop.toString()); | 0 |
1799 | } | - |
1800 | | - |
1801 | | - |
1802 | /*! | - |
1803 | \fn void QTextCharFormat::setTableCellRowSpan(int tableCellRowSpan) | - |
1804 | \internal | - |
1805 | | - |
1806 | If this character format is applied to characters in a table cell, | - |
1807 | the cell will span \a tableCellRowSpan rows. | - |
1808 | */ | - |
1809 | | - |
1810 | | - |
1811 | /*! | - |
1812 | \fn int QTextCharFormat::tableCellRowSpan() const | - |
1813 | \internal | - |
1814 | | - |
1815 | If this character format is applied to characters in a table cell, | - |
1816 | this function returns the number of rows spanned by the text (this may | - |
1817 | be 1); otherwise it returns 1. | - |
1818 | */ | - |
1819 | | - |
1820 | /*! | - |
1821 | \fn void QTextCharFormat::setTableCellColumnSpan(int tableCellColumnSpan) | - |
1822 | \internal | - |
1823 | | - |
1824 | If this character format is applied to characters in a table cell, | - |
1825 | the cell will span \a tableCellColumnSpan columns. | - |
1826 | */ | - |
1827 | | - |
1828 | | - |
1829 | /*! | - |
1830 | \fn int QTextCharFormat::tableCellColumnSpan() const | - |
1831 | \internal | - |
1832 | | - |
1833 | If this character format is applied to characters in a table cell, | - |
1834 | this function returns the number of columns spanned by the text (this | - |
1835 | may be 1); otherwise it returns 1. | - |
1836 | */ | - |
1837 | | - |
1838 | /*! | - |
1839 | \fn void QTextCharFormat::setUnderlineColor(const QColor &color) | - |
1840 | | - |
1841 | Sets the underline color used for the characters with this format to | - |
1842 | the \a color specified. | - |
1843 | | - |
1844 | \sa underlineColor() | - |
1845 | */ | - |
1846 | | - |
1847 | /*! | - |
1848 | \fn QColor QTextCharFormat::underlineColor() const | - |
1849 | | - |
1850 | Returns the color used to underline the characters with this format. | - |
1851 | | - |
1852 | \sa setUnderlineColor() | - |
1853 | */ | - |
1854 | | - |
1855 | /*! | - |
1856 | \fn void QTextCharFormat::setVerticalAlignment(VerticalAlignment alignment) | - |
1857 | | - |
1858 | Sets the vertical alignment used for the characters with this format to | - |
1859 | the \a alignment specified. | - |
1860 | | - |
1861 | \sa verticalAlignment() | - |
1862 | */ | - |
1863 | | - |
1864 | /*! | - |
1865 | \fn VerticalAlignment QTextCharFormat::verticalAlignment() const | - |
1866 | | - |
1867 | Returns the vertical alignment used for characters with this format. | - |
1868 | | - |
1869 | \sa setVerticalAlignment() | - |
1870 | */ | - |
1871 | | - |
1872 | /*! | - |
1873 | Sets the text format's \a font. | - |
1874 | */ | - |
1875 | void QTextCharFormat::setFont(const QFont &font) | - |
1876 | { | - |
1877 | setFontFamily(font.family()); executed (the execution status of this line is deduced): setFontFamily(font.family()); | - |
1878 | | - |
1879 | const qreal pointSize = font.pointSizeF(); executed (the execution status of this line is deduced): const qreal pointSize = font.pointSizeF(); | - |
1880 | if (pointSize > 0) { evaluated: pointSize > 0 yes Evaluation Count:14001 | yes Evaluation Count:1 |
| 1-14001 |
1881 | setFontPointSize(pointSize); executed (the execution status of this line is deduced): setFontPointSize(pointSize); | - |
1882 | } else { executed: } Execution Count:14001 | 14001 |
1883 | const int pixelSize = font.pixelSize(); executed (the execution status of this line is deduced): const int pixelSize = font.pixelSize(); | - |
1884 | if (pixelSize > 0) partially evaluated: pixelSize > 0 yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1885 | setProperty(QTextFormat::FontPixelSize, pixelSize); executed: setProperty(QTextFormat::FontPixelSize, pixelSize); Execution Count:1 | 1 |
1886 | } executed: } Execution Count:1 | 1 |
1887 | | - |
1888 | setFontWeight(font.weight()); executed (the execution status of this line is deduced): setFontWeight(font.weight()); | - |
1889 | setFontItalic(font.italic()); executed (the execution status of this line is deduced): setFontItalic(font.italic()); | - |
1890 | setUnderlineStyle(font.underline() ? SingleUnderline : NoUnderline); executed (the execution status of this line is deduced): setUnderlineStyle(font.underline() ? SingleUnderline : NoUnderline); | - |
1891 | setFontOverline(font.overline()); executed (the execution status of this line is deduced): setFontOverline(font.overline()); | - |
1892 | setFontStrikeOut(font.strikeOut()); executed (the execution status of this line is deduced): setFontStrikeOut(font.strikeOut()); | - |
1893 | setFontFixedPitch(font.fixedPitch()); executed (the execution status of this line is deduced): setFontFixedPitch(font.fixedPitch()); | - |
1894 | setFontCapitalization(font.capitalization()); executed (the execution status of this line is deduced): setFontCapitalization(font.capitalization()); | - |
1895 | setFontWordSpacing(font.wordSpacing()); executed (the execution status of this line is deduced): setFontWordSpacing(font.wordSpacing()); | - |
1896 | setFontLetterSpacingType(font.letterSpacingType()); executed (the execution status of this line is deduced): setFontLetterSpacingType(font.letterSpacingType()); | - |
1897 | setFontLetterSpacing(font.letterSpacing()); executed (the execution status of this line is deduced): setFontLetterSpacing(font.letterSpacing()); | - |
1898 | setFontStretch(font.stretch()); executed (the execution status of this line is deduced): setFontStretch(font.stretch()); | - |
1899 | setFontStyleHint(font.styleHint()); executed (the execution status of this line is deduced): setFontStyleHint(font.styleHint()); | - |
1900 | setFontStyleStrategy(font.styleStrategy()); executed (the execution status of this line is deduced): setFontStyleStrategy(font.styleStrategy()); | - |
1901 | setFontKerning(font.kerning()); executed (the execution status of this line is deduced): setFontKerning(font.kerning()); | - |
1902 | } executed: } Execution Count:14002 | 14002 |
1903 | | - |
1904 | /*! | - |
1905 | Returns the font for this character format. | - |
1906 | */ | - |
1907 | QFont QTextCharFormat::font() const | - |
1908 | { | - |
1909 | return d ? d->font() : QFont(); executed: return d ? d->font() : QFont(); Execution Count:18659 | 18659 |
1910 | } | - |
1911 | | - |
1912 | /*! | - |
1913 | \class QTextBlockFormat | - |
1914 | \reentrant | - |
1915 | | - |
1916 | \brief The QTextBlockFormat class provides formatting information for | - |
1917 | blocks of text in a QTextDocument. | - |
1918 | \inmodule QtGui | - |
1919 | | - |
1920 | \ingroup richtext-processing | - |
1921 | \ingroup shared | - |
1922 | | - |
1923 | A document is composed of a list of blocks, represented by QTextBlock | - |
1924 | objects. Each block can contain an item of some kind, such as a | - |
1925 | paragraph of text, a table, a list, or an image. Every block has an | - |
1926 | associated QTextBlockFormat that specifies its characteristics. | - |
1927 | | - |
1928 | To cater for left-to-right and right-to-left languages you can set | - |
1929 | a block's direction with setDirection(). Paragraph alignment is | - |
1930 | set with setAlignment(). Margins are controlled by setTopMargin(), | - |
1931 | setBottomMargin(), setLeftMargin(), setRightMargin(). Overall | - |
1932 | indentation is set with setIndent(), the indentation of the first | - |
1933 | line with setTextIndent(). | - |
1934 | | - |
1935 | Line spacing is set with setLineHeight() and retrieved via lineHeight() | - |
1936 | and lineHeightType(). The types of line spacing available are in the | - |
1937 | LineHeightTypes enum. | - |
1938 | | - |
1939 | Line breaking can be enabled and disabled with setNonBreakableLines(). | - |
1940 | | - |
1941 | The brush used to paint the paragraph's background | - |
1942 | is set with \l{QTextFormat::setBackground()}{setBackground()}, and other | - |
1943 | aspects of the text's appearance can be customized by using the | - |
1944 | \l{QTextFormat::setProperty()}{setProperty()} function with the | - |
1945 | \c OutlinePen, \c ForegroundBrush, and \c BackgroundBrush | - |
1946 | \l{QTextFormat::Property} values. | - |
1947 | | - |
1948 | If a text block is part of a list, it can also have a list format that | - |
1949 | is accessible with the listFormat() function. | - |
1950 | | - |
1951 | \sa QTextBlock, QTextCharFormat | - |
1952 | */ | - |
1953 | | - |
1954 | /*! | - |
1955 | \since 4.8 | - |
1956 | \enum QTextBlockFormat::LineHeightTypes | - |
1957 | | - |
1958 | This enum describes the various types of line spacing support paragraphs can have. | - |
1959 | | - |
1960 | \value SingleHeight This is the default line height: single spacing. | - |
1961 | \value ProportionalHeight This sets the spacing proportional to the line (in percentage). | - |
1962 | For example, set to 200 for double spacing. | - |
1963 | \value FixedHeight This sets the line height to a fixed line height (in pixels). | - |
1964 | \value MinimumHeight This sets the minimum line height (in pixels). | - |
1965 | \value LineDistanceHeight This adds the specified height between lines (in pixels). | - |
1966 | | - |
1967 | \sa lineHeight(), lineHeightType(), setLineHeight() | - |
1968 | */ | - |
1969 | | - |
1970 | /*! | - |
1971 | \fn QTextBlockFormat::QTextBlockFormat() | - |
1972 | | - |
1973 | Constructs a new QTextBlockFormat. | - |
1974 | */ | - |
1975 | QTextBlockFormat::QTextBlockFormat() : QTextFormat(BlockFormat) {} executed: } Execution Count:7422 | 7422 |
1976 | | - |
1977 | /*! | - |
1978 | \internal | - |
1979 | \fn QTextBlockFormat::QTextBlockFormat(const QTextFormat &other) | - |
1980 | | - |
1981 | Creates a new block format with the same attributes as the \a given | - |
1982 | text format. | - |
1983 | */ | - |
1984 | QTextBlockFormat::QTextBlockFormat(const QTextFormat &fmt) | - |
1985 | : QTextFormat(fmt) | - |
1986 | { | - |
1987 | } executed: } Execution Count:34916 | 34916 |
1988 | | - |
1989 | /*! | - |
1990 | \since 4.4 | - |
1991 | Sets the tab positions for the text block to those specified by | - |
1992 | \a tabs. | - |
1993 | | - |
1994 | \sa tabPositions() | - |
1995 | */ | - |
1996 | void QTextBlockFormat::setTabPositions(const QList<QTextOption::Tab> &tabs) | - |
1997 | { | - |
1998 | QList<QVariant> list; executed (the execution status of this line is deduced): QList<QVariant> list; | - |
1999 | QList<QTextOption::Tab>::ConstIterator iter = tabs.constBegin(); executed (the execution status of this line is deduced): QList<QTextOption::Tab>::ConstIterator iter = tabs.constBegin(); | - |
2000 | while (iter != tabs.constEnd()) { evaluated: iter != tabs.constEnd() yes Evaluation Count:4 | yes Evaluation Count:4 |
| 4 |
2001 | QVariant v; executed (the execution status of this line is deduced): QVariant v; | - |
2002 | v.setValue<QTextOption::Tab>(*iter); executed (the execution status of this line is deduced): v.setValue<QTextOption::Tab>(*iter); | - |
2003 | list.append(v); executed (the execution status of this line is deduced): list.append(v); | - |
2004 | ++iter; executed (the execution status of this line is deduced): ++iter; | - |
2005 | } executed: } Execution Count:4 | 4 |
2006 | setProperty(TabPositions, list); executed (the execution status of this line is deduced): setProperty(TabPositions, list); | - |
2007 | } executed: } Execution Count:4 | 4 |
2008 | | - |
2009 | /*! | - |
2010 | \since 4.4 | - |
2011 | Returns a list of tab positions defined for the text block. | - |
2012 | | - |
2013 | \sa setTabPositions() | - |
2014 | */ | - |
2015 | QList<QTextOption::Tab> QTextBlockFormat::tabPositions() const | - |
2016 | { | - |
2017 | QVariant variant = property(TabPositions); executed (the execution status of this line is deduced): QVariant variant = property(TabPositions); | - |
2018 | if(variant.isNull()) evaluated: variant.isNull() yes Evaluation Count:3612 | yes Evaluation Count:4 |
| 4-3612 |
2019 | return QList<QTextOption::Tab>(); executed: return QList<QTextOption::Tab>(); Execution Count:3612 | 3612 |
2020 | QList<QTextOption::Tab> answer; executed (the execution status of this line is deduced): QList<QTextOption::Tab> answer; | - |
2021 | QList<QVariant> variantsList = qvariant_cast<QList<QVariant> >(variant); executed (the execution status of this line is deduced): QList<QVariant> variantsList = qvariant_cast<QList<QVariant> >(variant); | - |
2022 | QList<QVariant>::Iterator iter = variantsList.begin(); executed (the execution status of this line is deduced): QList<QVariant>::Iterator iter = variantsList.begin(); | - |
2023 | while(iter != variantsList.end()) { evaluated: iter != variantsList.end() yes Evaluation Count:4 | yes Evaluation Count:4 |
| 4 |
2024 | answer.append( qvariant_cast<QTextOption::Tab>(*iter)); executed (the execution status of this line is deduced): answer.append( qvariant_cast<QTextOption::Tab>(*iter)); | - |
2025 | ++iter; executed (the execution status of this line is deduced): ++iter; | - |
2026 | } executed: } Execution Count:4 | 4 |
2027 | return answer; executed: return answer; Execution Count:4 | 4 |
2028 | } | - |
2029 | | - |
2030 | /*! | - |
2031 | \fn QTextBlockFormat::isValid() const | - |
2032 | | - |
2033 | Returns true if this block format is valid; otherwise returns | - |
2034 | false. | - |
2035 | */ | - |
2036 | | - |
2037 | /*! | - |
2038 | \fn void QTextFormat::setLayoutDirection(Qt::LayoutDirection direction) | - |
2039 | | - |
2040 | Sets the document's layout direction to the specified \a direction. | - |
2041 | | - |
2042 | \sa layoutDirection() | - |
2043 | */ | - |
2044 | | - |
2045 | | - |
2046 | /*! | - |
2047 | \fn Qt::LayoutDirection QTextFormat::layoutDirection() const | - |
2048 | | - |
2049 | Returns the document's layout direction. | - |
2050 | | - |
2051 | \sa setLayoutDirection() | - |
2052 | */ | - |
2053 | | - |
2054 | | - |
2055 | /*! | - |
2056 | \fn void QTextBlockFormat::setAlignment(Qt::Alignment alignment) | - |
2057 | | - |
2058 | Sets the paragraph's \a alignment. | - |
2059 | | - |
2060 | \sa alignment() | - |
2061 | */ | - |
2062 | | - |
2063 | | - |
2064 | /*! | - |
2065 | \fn Qt::Alignment QTextBlockFormat::alignment() const | - |
2066 | | - |
2067 | Returns the paragraph's alignment. | - |
2068 | | - |
2069 | \sa setAlignment() | - |
2070 | */ | - |
2071 | | - |
2072 | | - |
2073 | /*! | - |
2074 | \fn void QTextBlockFormat::setTopMargin(qreal margin) | - |
2075 | | - |
2076 | Sets the paragraph's top \a margin. | - |
2077 | | - |
2078 | \sa topMargin(), setBottomMargin(), setLeftMargin(), setRightMargin() | - |
2079 | */ | - |
2080 | | - |
2081 | | - |
2082 | /*! | - |
2083 | \fn qreal QTextBlockFormat::topMargin() const | - |
2084 | | - |
2085 | Returns the paragraph's top margin. | - |
2086 | | - |
2087 | \sa setTopMargin(), bottomMargin() | - |
2088 | */ | - |
2089 | | - |
2090 | | - |
2091 | /*! | - |
2092 | \fn void QTextBlockFormat::setBottomMargin(qreal margin) | - |
2093 | | - |
2094 | Sets the paragraph's bottom \a margin. | - |
2095 | | - |
2096 | \sa bottomMargin(), setTopMargin(), setLeftMargin(), setRightMargin() | - |
2097 | */ | - |
2098 | | - |
2099 | | - |
2100 | /*! | - |
2101 | \fn qreal QTextBlockFormat::bottomMargin() const | - |
2102 | | - |
2103 | Returns the paragraph's bottom margin. | - |
2104 | | - |
2105 | \sa setBottomMargin(), topMargin() | - |
2106 | */ | - |
2107 | | - |
2108 | | - |
2109 | /*! | - |
2110 | \fn void QTextBlockFormat::setLeftMargin(qreal margin) | - |
2111 | | - |
2112 | Sets the paragraph's left \a margin. Indentation can be applied separately | - |
2113 | with setIndent(). | - |
2114 | | - |
2115 | \sa leftMargin(), setRightMargin(), setTopMargin(), setBottomMargin() | - |
2116 | */ | - |
2117 | | - |
2118 | | - |
2119 | /*! | - |
2120 | \fn qreal QTextBlockFormat::leftMargin() const | - |
2121 | | - |
2122 | Returns the paragraph's left margin. | - |
2123 | | - |
2124 | \sa setLeftMargin(), rightMargin(), indent() | - |
2125 | */ | - |
2126 | | - |
2127 | | - |
2128 | /*! | - |
2129 | \fn void QTextBlockFormat::setRightMargin(qreal margin) | - |
2130 | | - |
2131 | Sets the paragraph's right \a margin. | - |
2132 | | - |
2133 | \sa rightMargin(), setLeftMargin(), setTopMargin(), setBottomMargin() | - |
2134 | */ | - |
2135 | | - |
2136 | | - |
2137 | /*! | - |
2138 | \fn qreal QTextBlockFormat::rightMargin() const | - |
2139 | | - |
2140 | Returns the paragraph's right margin. | - |
2141 | | - |
2142 | \sa setRightMargin(), leftMargin() | - |
2143 | */ | - |
2144 | | - |
2145 | | - |
2146 | /*! | - |
2147 | \fn void QTextBlockFormat::setTextIndent(qreal indent) | - |
2148 | | - |
2149 | Sets the \a indent for the first line in the block. This allows the first | - |
2150 | line of a paragraph to be indented differently to the other lines, | - |
2151 | enhancing the readability of the text. | - |
2152 | | - |
2153 | \sa textIndent(), setLeftMargin(), setRightMargin(), setTopMargin(), setBottomMargin() | - |
2154 | */ | - |
2155 | | - |
2156 | | - |
2157 | /*! | - |
2158 | \fn qreal QTextBlockFormat::textIndent() const | - |
2159 | | - |
2160 | Returns the paragraph's text indent. | - |
2161 | | - |
2162 | \sa setTextIndent() | - |
2163 | */ | - |
2164 | | - |
2165 | | - |
2166 | /*! | - |
2167 | \fn void QTextBlockFormat::setIndent(int indentation) | - |
2168 | | - |
2169 | Sets the paragraph's \a indentation. Margins are set independently of | - |
2170 | indentation with setLeftMargin() and setTextIndent(). | - |
2171 | The \a indentation is an integer that is multiplied with the document-wide | - |
2172 | standard indent, resulting in the actual indent of the paragraph. | - |
2173 | | - |
2174 | \sa indent(), QTextDocument::indentWidth() | - |
2175 | */ | - |
2176 | | - |
2177 | | - |
2178 | /*! | - |
2179 | \fn int QTextBlockFormat::indent() const | - |
2180 | | - |
2181 | Returns the paragraph's indent. | - |
2182 | | - |
2183 | \sa setIndent() | - |
2184 | */ | - |
2185 | | - |
2186 | | - |
2187 | /*! | - |
2188 | \fn void QTextBlockFormat::setLineHeight(qreal height, int heightType) | - |
2189 | \since 4.8 | - |
2190 | | - |
2191 | Sets the line height for the paragraph to the value given by \a height | - |
2192 | which is dependent on \a heightType in the way described by the | - |
2193 | LineHeightTypes enum. | - |
2194 | | - |
2195 | \sa LineHeightTypes, lineHeight(), lineHeightType() | - |
2196 | */ | - |
2197 | | - |
2198 | | - |
2199 | /*! | - |
2200 | \fn qreal QTextBlockFormat::lineHeight(qreal scriptLineHeight, qreal scaling) const | - |
2201 | \since 4.8 | - |
2202 | | - |
2203 | Returns the height of the lines in the paragraph based on the height of the | - |
2204 | script line given by \a scriptLineHeight and the specified \a scaling | - |
2205 | factor. | - |
2206 | | - |
2207 | The value that is returned is also dependent on the given LineHeightType of | - |
2208 | the paragraph as well as the LineHeight setting that has been set for the | - |
2209 | paragraph. | - |
2210 | | - |
2211 | The scaling is needed for heights that include a fixed number of pixels, to | - |
2212 | scale them appropriately for printing. | - |
2213 | | - |
2214 | \sa LineHeightTypes, setLineHeight(), lineHeightType() | - |
2215 | */ | - |
2216 | | - |
2217 | | - |
2218 | /*! | - |
2219 | \fn qreal QTextBlockFormat::lineHeight() const | - |
2220 | \since 4.8 | - |
2221 | | - |
2222 | This returns the LineHeight property for the paragraph. | - |
2223 | | - |
2224 | \sa LineHeightTypes, setLineHeight(), lineHeightType() | - |
2225 | */ | - |
2226 | | - |
2227 | | - |
2228 | /*! | - |
2229 | \fn qreal QTextBlockFormat::lineHeightType() const | - |
2230 | \since 4.8 | - |
2231 | | - |
2232 | This returns the LineHeightType property of the paragraph. | - |
2233 | | - |
2234 | \sa LineHeightTypes, setLineHeight(), lineHeight() | - |
2235 | */ | - |
2236 | | - |
2237 | | - |
2238 | /*! | - |
2239 | \fn void QTextBlockFormat::setNonBreakableLines(bool b) | - |
2240 | | - |
2241 | If \a b is true, the lines in the paragraph are treated as | - |
2242 | non-breakable; otherwise they are breakable. | - |
2243 | | - |
2244 | \sa nonBreakableLines() | - |
2245 | */ | - |
2246 | | - |
2247 | | - |
2248 | /*! | - |
2249 | \fn bool QTextBlockFormat::nonBreakableLines() const | - |
2250 | | - |
2251 | Returns true if the lines in the paragraph are non-breakable; | - |
2252 | otherwise returns false. | - |
2253 | | - |
2254 | \sa setNonBreakableLines() | - |
2255 | */ | - |
2256 | | - |
2257 | /*! | - |
2258 | \fn QTextFormat::PageBreakFlags QTextBlockFormat::pageBreakPolicy() const | - |
2259 | \since 4.2 | - |
2260 | | - |
2261 | Returns the currently set page break policy for the paragraph. The default is | - |
2262 | QTextFormat::PageBreak_Auto. | - |
2263 | | - |
2264 | \sa setPageBreakPolicy() | - |
2265 | */ | - |
2266 | | - |
2267 | /*! | - |
2268 | \fn void QTextBlockFormat::setPageBreakPolicy(PageBreakFlags policy) | - |
2269 | \since 4.2 | - |
2270 | | - |
2271 | Sets the page break policy for the paragraph to \a policy. | - |
2272 | | - |
2273 | \sa pageBreakPolicy() | - |
2274 | */ | - |
2275 | | - |
2276 | /*! | - |
2277 | \class QTextListFormat | - |
2278 | \reentrant | - |
2279 | | - |
2280 | \brief The QTextListFormat class provides formatting information for | - |
2281 | lists in a QTextDocument. | - |
2282 | \inmodule QtGui | - |
2283 | | - |
2284 | \ingroup richtext-processing | - |
2285 | \ingroup shared | - |
2286 | | - |
2287 | A list is composed of one or more items, represented as text blocks. | - |
2288 | The list's format specifies the appearance of items in the list. | - |
2289 | In particular, it determines the indentation and the style of each item. | - |
2290 | | - |
2291 | The indentation of the items is an integer value that causes each item to | - |
2292 | be offset from the left margin by a certain amount. This value is read with | - |
2293 | indent() and set with setIndent(). | - |
2294 | | - |
2295 | The style used to decorate each item is set with setStyle() and can be read | - |
2296 | with the style() function. The style controls the type of bullet points and | - |
2297 | numbering scheme used for items in the list. Note that lists that use the | - |
2298 | decimal numbering scheme begin counting at 1 rather than 0. | - |
2299 | | - |
2300 | Style properties can be set to further configure the appearance of list | - |
2301 | items; for example, the ListNumberPrefix and ListNumberSuffix properties | - |
2302 | can be used to customize the numbers used in an ordered list so that they | - |
2303 | appear as (1), (2), (3), etc.: | - |
2304 | | - |
2305 | \snippet textdocument-listitemstyles/mainwindow.cpp add a styled, ordered list | - |
2306 | | - |
2307 | \sa QTextList | - |
2308 | */ | - |
2309 | | - |
2310 | /*! | - |
2311 | \enum QTextListFormat::Style | - |
2312 | | - |
2313 | This enum describes the symbols used to decorate list items: | - |
2314 | | - |
2315 | \value ListDisc a filled circle | - |
2316 | \value ListCircle an empty circle | - |
2317 | \value ListSquare a filled square | - |
2318 | \value ListDecimal decimal values in ascending order | - |
2319 | \value ListLowerAlpha lower case Latin characters in alphabetical order | - |
2320 | \value ListUpperAlpha upper case Latin characters in alphabetical order | - |
2321 | \value ListLowerRoman lower case roman numerals (supports up to 4999 items only) | - |
2322 | \value ListUpperRoman upper case roman numerals (supports up to 4999 items only) | - |
2323 | \omitvalue ListStyleUndefined | - |
2324 | */ | - |
2325 | | - |
2326 | /*! | - |
2327 | \fn QTextListFormat::QTextListFormat() | - |
2328 | | - |
2329 | Constructs a new list format object. | - |
2330 | */ | - |
2331 | QTextListFormat::QTextListFormat() | - |
2332 | : QTextFormat(ListFormat) | - |
2333 | { | - |
2334 | setIndent(1); executed (the execution status of this line is deduced): setIndent(1); | - |
2335 | } executed: } Execution Count:117 | 117 |
2336 | | - |
2337 | /*! | - |
2338 | \internal | - |
2339 | \fn QTextListFormat::QTextListFormat(const QTextFormat &other) | - |
2340 | | - |
2341 | Creates a new list format with the same attributes as the \a given | - |
2342 | text format. | - |
2343 | */ | - |
2344 | QTextListFormat::QTextListFormat(const QTextFormat &fmt) | - |
2345 | : QTextFormat(fmt) | - |
2346 | { | - |
2347 | } executed: } Execution Count:87 | 87 |
2348 | | - |
2349 | /*! | - |
2350 | \fn bool QTextListFormat::isValid() const | - |
2351 | | - |
2352 | Returns true if this list format is valid; otherwise | - |
2353 | returns false. | - |
2354 | */ | - |
2355 | | - |
2356 | /*! | - |
2357 | \fn void QTextListFormat::setStyle(Style style) | - |
2358 | | - |
2359 | Sets the list format's \a style. | - |
2360 | | - |
2361 | \sa style(), Style | - |
2362 | */ | - |
2363 | | - |
2364 | /*! | - |
2365 | \fn Style QTextListFormat::style() const | - |
2366 | | - |
2367 | Returns the list format's style. | - |
2368 | | - |
2369 | \sa setStyle(), Style | - |
2370 | */ | - |
2371 | | - |
2372 | | - |
2373 | /*! | - |
2374 | \fn void QTextListFormat::setIndent(int indentation) | - |
2375 | | - |
2376 | Sets the list format's \a indentation. | - |
2377 | The indentation is multiplied by the QTextDocument::indentWidth | - |
2378 | property to get the effective indent in pixels. | - |
2379 | | - |
2380 | \sa indent() | - |
2381 | */ | - |
2382 | | - |
2383 | | - |
2384 | /*! | - |
2385 | \fn int QTextListFormat::indent() const | - |
2386 | | - |
2387 | Returns the list format's indentation. | - |
2388 | The indentation is multiplied by the QTextDocument::indentWidth | - |
2389 | property to get the effective indent in pixels. | - |
2390 | | - |
2391 | \sa setIndent() | - |
2392 | */ | - |
2393 | | - |
2394 | /*! | - |
2395 | \fn void QTextListFormat::setNumberPrefix(const QString &numberPrefix) | - |
2396 | \since 4.8 | - |
2397 | | - |
2398 | Sets the list format's number prefix to the string specified by | - |
2399 | \a numberPrefix. This can be used with all sorted list types. It does not | - |
2400 | have any effect on unsorted list types. | - |
2401 | | - |
2402 | The default prefix is an empty string. | - |
2403 | | - |
2404 | \sa numberPrefix() | - |
2405 | */ | - |
2406 | | - |
2407 | /*! | - |
2408 | \fn int QTextListFormat::numberPrefix() const | - |
2409 | \since 4.8 | - |
2410 | | - |
2411 | Returns the list format's number prefix. | - |
2412 | | - |
2413 | \sa setNumberPrefix() | - |
2414 | */ | - |
2415 | | - |
2416 | /*! | - |
2417 | \fn void QTextListFormat::setNumberSuffix(const QString &numberSuffix) | - |
2418 | \since 4.8 | - |
2419 | | - |
2420 | Sets the list format's number suffix to the string specified by | - |
2421 | \a numberSuffix. This can be used with all sorted list types. It does not | - |
2422 | have any effect on unsorted list types. | - |
2423 | | - |
2424 | The default suffix is ".". | - |
2425 | | - |
2426 | \sa numberSuffix() | - |
2427 | */ | - |
2428 | | - |
2429 | /*! | - |
2430 | \fn int QTextListFormat::numberSuffix() const | - |
2431 | \since 4.8 | - |
2432 | | - |
2433 | Returns the list format's number suffix. | - |
2434 | | - |
2435 | \sa setNumberSuffix() | - |
2436 | */ | - |
2437 | | - |
2438 | /*! | - |
2439 | \class QTextFrameFormat | - |
2440 | \reentrant | - |
2441 | | - |
2442 | \brief The QTextFrameFormat class provides formatting information for | - |
2443 | frames in a QTextDocument. | - |
2444 | \inmodule QtGui | - |
2445 | | - |
2446 | \ingroup richtext-processing | - |
2447 | \ingroup shared | - |
2448 | | - |
2449 | A text frame groups together one or more blocks of text, providing a layer | - |
2450 | of structure larger than the paragraph. The format of a frame specifies | - |
2451 | how it is rendered and positioned on the screen. It does not directly | - |
2452 | specify the behavior of the text formatting within, but provides | - |
2453 | constraints on the layout of its children. | - |
2454 | | - |
2455 | The frame format defines the width() and height() of the frame on the | - |
2456 | screen. Each frame can have a border() that surrounds its contents with | - |
2457 | a rectangular box. The border is surrounded by a margin() around the frame, | - |
2458 | and the contents of the frame are kept separate from the border by the | - |
2459 | frame's padding(). This scheme is similar to the box model used by Cascading | - |
2460 | Style Sheets for HTML pages. | - |
2461 | | - |
2462 | \image qtextframe-style.png | - |
2463 | | - |
2464 | The position() of a frame is set using setPosition() and determines how it | - |
2465 | is located relative to the surrounding text. | - |
2466 | | - |
2467 | The validity of a QTextFrameFormat object can be determined with the | - |
2468 | isValid() function. | - |
2469 | | - |
2470 | \sa QTextFrame, QTextBlockFormat | - |
2471 | */ | - |
2472 | | - |
2473 | /*! | - |
2474 | \enum QTextFrameFormat::Position | - |
2475 | | - |
2476 | This enum describes how a frame is located relative to the surrounding text. | - |
2477 | | - |
2478 | \value InFlow | - |
2479 | \value FloatLeft | - |
2480 | \value FloatRight | - |
2481 | | - |
2482 | \sa position(), CssFloat | - |
2483 | */ | - |
2484 | | - |
2485 | /*! | - |
2486 | \enum QTextFrameFormat::BorderStyle | - |
2487 | \since 4.3 | - |
2488 | | - |
2489 | This enum describes different border styles for the text frame. | - |
2490 | | - |
2491 | \value BorderStyle_None | - |
2492 | \value BorderStyle_Dotted | - |
2493 | \value BorderStyle_Dashed | - |
2494 | \value BorderStyle_Solid | - |
2495 | \value BorderStyle_Double | - |
2496 | \value BorderStyle_DotDash | - |
2497 | \value BorderStyle_DotDotDash | - |
2498 | \value BorderStyle_Groove | - |
2499 | \value BorderStyle_Ridge | - |
2500 | \value BorderStyle_Inset | - |
2501 | \value BorderStyle_Outset | - |
2502 | | - |
2503 | \sa borderStyle(), FrameBorderStyle | - |
2504 | */ | - |
2505 | | - |
2506 | /*! | - |
2507 | \fn QTextFrameFormat::QTextFrameFormat() | - |
2508 | | - |
2509 | Constructs a text frame format object with the default properties. | - |
2510 | */ | - |
2511 | QTextFrameFormat::QTextFrameFormat() : QTextFormat(FrameFormat) | - |
2512 | { | - |
2513 | setBorderStyle(BorderStyle_Outset); executed (the execution status of this line is deduced): setBorderStyle(BorderStyle_Outset); | - |
2514 | setBorderBrush(Qt::darkGray); executed (the execution status of this line is deduced): setBorderBrush(Qt::darkGray); | - |
2515 | } executed: } Execution Count:2200 | 2200 |
2516 | | - |
2517 | /*! | - |
2518 | \internal | - |
2519 | \fn QTextFrameFormat::QTextFrameFormat(const QTextFormat &other) | - |
2520 | | - |
2521 | Creates a new frame format with the same attributes as the \a given | - |
2522 | text format. | - |
2523 | */ | - |
2524 | QTextFrameFormat::QTextFrameFormat(const QTextFormat &fmt) | - |
2525 | : QTextFormat(fmt) | - |
2526 | { | - |
2527 | } executed: } Execution Count:5289 | 5289 |
2528 | | - |
2529 | /*! | - |
2530 | \fn QTextFrameFormat::isValid() const | - |
2531 | | - |
2532 | Returns true if the format description is valid; otherwise returns false. | - |
2533 | */ | - |
2534 | | - |
2535 | /*! | - |
2536 | \fn QTextFrameFormat::setPosition(Position policy) | - |
2537 | | - |
2538 | Sets the \a policy for positioning frames with this frame format. | - |
2539 | | - |
2540 | */ | - |
2541 | | - |
2542 | /*! | - |
2543 | \fn Position QTextFrameFormat::position() const | - |
2544 | | - |
2545 | Returns the positioning policy for frames with this frame format. | - |
2546 | */ | - |
2547 | | - |
2548 | /*! | - |
2549 | \fn QTextFrameFormat::setBorder(qreal width) | - |
2550 | | - |
2551 | Sets the \a width (in pixels) of the frame's border. | - |
2552 | */ | - |
2553 | | - |
2554 | /*! | - |
2555 | \fn qreal QTextFrameFormat::border() const | - |
2556 | | - |
2557 | Returns the width of the border in pixels. | - |
2558 | */ | - |
2559 | | - |
2560 | /*! | - |
2561 | \fn QTextFrameFormat::setBorderBrush(const QBrush &brush) | - |
2562 | \since 4.3 | - |
2563 | | - |
2564 | Sets the \a brush used for the frame's border. | - |
2565 | */ | - |
2566 | | - |
2567 | /*! | - |
2568 | \fn QBrush QTextFrameFormat::borderBrush() const | - |
2569 | \since 4.3 | - |
2570 | | - |
2571 | Returns the brush used for the frame's border. | - |
2572 | */ | - |
2573 | | - |
2574 | /*! | - |
2575 | \fn QTextFrameFormat::setBorderStyle(BorderStyle style) | - |
2576 | \since 4.3 | - |
2577 | | - |
2578 | Sets the \a style of the frame's border. | - |
2579 | */ | - |
2580 | | - |
2581 | /*! | - |
2582 | \fn BorderStyle QTextFrameFormat::borderStyle() const | - |
2583 | \since 4.3 | - |
2584 | | - |
2585 | Returns the style of the frame's border. | - |
2586 | */ | - |
2587 | | - |
2588 | /*! | - |
2589 | \fn QTextFrameFormat::setMargin(qreal margin) | - |
2590 | | - |
2591 | Sets the frame's \a margin in pixels. | - |
2592 | This method also sets the left, right, top and bottom margins | - |
2593 | of the frame to the same value. The individual margins override | - |
2594 | the general margin. | - |
2595 | */ | - |
2596 | void QTextFrameFormat::setMargin(qreal amargin) | - |
2597 | { | - |
2598 | setProperty(FrameMargin, amargin); executed (the execution status of this line is deduced): setProperty(FrameMargin, amargin); | - |
2599 | setProperty(FrameTopMargin, amargin); executed (the execution status of this line is deduced): setProperty(FrameTopMargin, amargin); | - |
2600 | setProperty(FrameBottomMargin, amargin); executed (the execution status of this line is deduced): setProperty(FrameBottomMargin, amargin); | - |
2601 | setProperty(FrameLeftMargin, amargin); executed (the execution status of this line is deduced): setProperty(FrameLeftMargin, amargin); | - |
2602 | setProperty(FrameRightMargin, amargin); executed (the execution status of this line is deduced): setProperty(FrameRightMargin, amargin); | - |
2603 | } executed: } Execution Count:1962 | 1962 |
2604 | | - |
2605 | | - |
2606 | /*! | - |
2607 | \fn qreal QTextFrameFormat::margin() const | - |
2608 | | - |
2609 | Returns the width of the frame's external margin in pixels. | - |
2610 | */ | - |
2611 | | - |
2612 | /*! | - |
2613 | \fn QTextFrameFormat::setTopMargin(qreal margin) | - |
2614 | \since 4.3 | - |
2615 | | - |
2616 | Sets the frame's top \a margin in pixels. | - |
2617 | */ | - |
2618 | | - |
2619 | /*! | - |
2620 | \fn qreal QTextFrameFormat::topMargin() const | - |
2621 | \since 4.3 | - |
2622 | | - |
2623 | Returns the width of the frame's top margin in pixels. | - |
2624 | */ | - |
2625 | qreal QTextFrameFormat::topMargin() const | - |
2626 | { | - |
2627 | if (!hasProperty(FrameTopMargin)) evaluated: !hasProperty(FrameTopMargin) yes Evaluation Count:27 | yes Evaluation Count:2028 |
| 27-2028 |
2628 | return margin(); executed: return margin(); Execution Count:27 | 27 |
2629 | return doubleProperty(FrameTopMargin); executed: return doubleProperty(FrameTopMargin); Execution Count:2028 | 2028 |
2630 | } | - |
2631 | | - |
2632 | /*! | - |
2633 | \fn QTextFrameFormat::setBottomMargin(qreal margin) | - |
2634 | \since 4.3 | - |
2635 | | - |
2636 | Sets the frame's bottom \a margin in pixels. | - |
2637 | */ | - |
2638 | | - |
2639 | /*! | - |
2640 | \fn qreal QTextFrameFormat::bottomMargin() const | - |
2641 | \since 4.3 | - |
2642 | | - |
2643 | Returns the width of the frame's bottom margin in pixels. | - |
2644 | */ | - |
2645 | qreal QTextFrameFormat::bottomMargin() const | - |
2646 | { | - |
2647 | if (!hasProperty(FrameBottomMargin)) evaluated: !hasProperty(FrameBottomMargin) yes Evaluation Count:26 | yes Evaluation Count:2027 |
| 26-2027 |
2648 | return margin(); executed: return margin(); Execution Count:26 | 26 |
2649 | return doubleProperty(FrameBottomMargin); executed: return doubleProperty(FrameBottomMargin); Execution Count:2027 | 2027 |
2650 | } | - |
2651 | | - |
2652 | /*! | - |
2653 | \fn QTextFrameFormat::setLeftMargin(qreal margin) | - |
2654 | \since 4.3 | - |
2655 | | - |
2656 | Sets the frame's left \a margin in pixels. | - |
2657 | */ | - |
2658 | | - |
2659 | /*! | - |
2660 | \fn qreal QTextFrameFormat::leftMargin() const | - |
2661 | \since 4.3 | - |
2662 | | - |
2663 | Returns the width of the frame's left margin in pixels. | - |
2664 | */ | - |
2665 | qreal QTextFrameFormat::leftMargin() const | - |
2666 | { | - |
2667 | if (!hasProperty(FrameLeftMargin)) evaluated: !hasProperty(FrameLeftMargin) yes Evaluation Count:26 | yes Evaluation Count:2245 |
| 26-2245 |
2668 | return margin(); executed: return margin(); Execution Count:26 | 26 |
2669 | return doubleProperty(FrameLeftMargin); executed: return doubleProperty(FrameLeftMargin); Execution Count:2245 | 2245 |
2670 | } | - |
2671 | | - |
2672 | /*! | - |
2673 | \fn QTextFrameFormat::setRightMargin(qreal margin) | - |
2674 | \since 4.3 | - |
2675 | | - |
2676 | Sets the frame's right \a margin in pixels. | - |
2677 | */ | - |
2678 | | - |
2679 | /*! | - |
2680 | \fn qreal QTextFrameFormat::rightMargin() const | - |
2681 | \since 4.3 | - |
2682 | | - |
2683 | Returns the width of the frame's right margin in pixels. | - |
2684 | */ | - |
2685 | qreal QTextFrameFormat::rightMargin() const | - |
2686 | { | - |
2687 | if (!hasProperty(FrameRightMargin)) evaluated: !hasProperty(FrameRightMargin) yes Evaluation Count:27 | yes Evaluation Count:2029 |
| 27-2029 |
2688 | return margin(); executed: return margin(); Execution Count:27 | 27 |
2689 | return doubleProperty(FrameRightMargin); executed: return doubleProperty(FrameRightMargin); Execution Count:2029 | 2029 |
2690 | } | - |
2691 | | - |
2692 | /*! | - |
2693 | \fn QTextFrameFormat::setPadding(qreal width) | - |
2694 | | - |
2695 | Sets the \a width of the frame's internal padding in pixels. | - |
2696 | */ | - |
2697 | | - |
2698 | /*! | - |
2699 | \fn qreal QTextFrameFormat::padding() const | - |
2700 | | - |
2701 | Returns the width of the frame's internal padding in pixels. | - |
2702 | */ | - |
2703 | | - |
2704 | /*! | - |
2705 | \fn QTextFrameFormat::setWidth(const QTextLength &width) | - |
2706 | | - |
2707 | Sets the frame's border rectangle's \a width. | - |
2708 | | - |
2709 | \sa QTextLength | - |
2710 | */ | - |
2711 | | - |
2712 | /*! | - |
2713 | \fn QTextFrameFormat::setWidth(qreal width) | - |
2714 | \overload | - |
2715 | | - |
2716 | Convenience method that sets the width of the frame's border | - |
2717 | rectangle's width to the specified fixed \a width. | - |
2718 | */ | - |
2719 | | - |
2720 | /*! | - |
2721 | \fn QTextFormat::PageBreakFlags QTextFrameFormat::pageBreakPolicy() const | - |
2722 | \since 4.2 | - |
2723 | | - |
2724 | Returns the currently set page break policy for the frame/table. The default is | - |
2725 | QTextFormat::PageBreak_Auto. | - |
2726 | | - |
2727 | \sa setPageBreakPolicy() | - |
2728 | */ | - |
2729 | | - |
2730 | /*! | - |
2731 | \fn void QTextFrameFormat::setPageBreakPolicy(PageBreakFlags policy) | - |
2732 | \since 4.2 | - |
2733 | | - |
2734 | Sets the page break policy for the frame/table to \a policy. | - |
2735 | | - |
2736 | \sa pageBreakPolicy() | - |
2737 | */ | - |
2738 | | - |
2739 | /*! | - |
2740 | \fn QTextLength QTextFrameFormat::width() const | - |
2741 | | - |
2742 | Returns the width of the frame's border rectangle. | - |
2743 | | - |
2744 | \sa QTextLength | - |
2745 | */ | - |
2746 | | - |
2747 | /*! | - |
2748 | \fn void QTextFrameFormat::setHeight(const QTextLength &height) | - |
2749 | | - |
2750 | Sets the frame's \a height. | - |
2751 | */ | - |
2752 | | - |
2753 | /*! | - |
2754 | \fn void QTextFrameFormat::setHeight(qreal height) | - |
2755 | \overload | - |
2756 | | - |
2757 | Sets the frame's \a height. | - |
2758 | */ | - |
2759 | | - |
2760 | /*! | - |
2761 | \fn qreal QTextFrameFormat::height() const | - |
2762 | | - |
2763 | Returns the height of the frame's border rectangle. | - |
2764 | */ | - |
2765 | | - |
2766 | /*! | - |
2767 | \class QTextTableFormat | - |
2768 | \reentrant | - |
2769 | | - |
2770 | \brief The QTextTableFormat class provides formatting information for | - |
2771 | tables in a QTextDocument. | - |
2772 | \inmodule QtGui | - |
2773 | | - |
2774 | \ingroup richtext-processing | - |
2775 | \ingroup shared | - |
2776 | | - |
2777 | A table is a group of cells ordered into rows and columns. Each table | - |
2778 | contains at least one row and one column. Each cell contains a block. | - |
2779 | Tables in rich text documents are formatted using the properties | - |
2780 | defined in this class. | - |
2781 | | - |
2782 | Tables are horizontally justified within their parent frame according to the | - |
2783 | table's alignment. This can be read with the alignment() function and set | - |
2784 | with setAlignment(). | - |
2785 | | - |
2786 | Cells within the table are separated by cell spacing. The number of pixels | - |
2787 | between cells is set with setCellSpacing() and read with cellSpacing(). | - |
2788 | The contents of each cell is surrounded by cell padding. The number of pixels | - |
2789 | between each cell edge and its contents is set with setCellPadding() and read | - |
2790 | with cellPadding(). | - |
2791 | | - |
2792 | \image qtexttableformat-cell.png | - |
2793 | | - |
2794 | The table's background color can be read with the background() function, | - |
2795 | and can be specified with setBackground(). The background color of each | - |
2796 | cell can be set independently, and will control the color of the cell within | - |
2797 | the padded area. | - |
2798 | | - |
2799 | The table format also provides a way to constrain the widths of the columns | - |
2800 | in the table. Columns can be assigned a fixed width, a variable width, or | - |
2801 | a percentage of the available width (see QTextLength). The columns() function | - |
2802 | returns the number of columns with constraints, and the | - |
2803 | columnWidthConstraints() function returns the constraints defined for the | - |
2804 | table. These quantities can also be set by calling setColumnWidthConstraints() | - |
2805 | with a vector containing new constraints. If no constraints are | - |
2806 | required, clearColumnWidthConstraints() can be used to remove them. | - |
2807 | | - |
2808 | \sa QTextTable, QTextTableCell, QTextLength | - |
2809 | */ | - |
2810 | | - |
2811 | /*! | - |
2812 | \fn QTextTableFormat::QTextTableFormat() | - |
2813 | | - |
2814 | Constructs a new table format object. | - |
2815 | */ | - |
2816 | QTextTableFormat::QTextTableFormat() | - |
2817 | : QTextFrameFormat() | - |
2818 | { | - |
2819 | setObjectType(TableObject); executed (the execution status of this line is deduced): setObjectType(TableObject); | - |
2820 | setCellSpacing(2); executed (the execution status of this line is deduced): setCellSpacing(2); | - |
2821 | setBorder(1); executed (the execution status of this line is deduced): setBorder(1); | - |
2822 | } executed: } Execution Count:152 | 152 |
2823 | | - |
2824 | /*! | - |
2825 | \internal | - |
2826 | \fn QTextTableFormat::QTextTableFormat(const QTextFormat &other) | - |
2827 | | - |
2828 | Creates a new table format with the same attributes as the \a given | - |
2829 | text format. | - |
2830 | */ | - |
2831 | QTextTableFormat::QTextTableFormat(const QTextFormat &fmt) | - |
2832 | : QTextFrameFormat(fmt) | - |
2833 | { | - |
2834 | } executed: } Execution Count:626 | 626 |
2835 | | - |
2836 | /*! | - |
2837 | \fn bool QTextTableFormat::isValid() const | - |
2838 | | - |
2839 | Returns true if this table format is valid; otherwise | - |
2840 | returns false. | - |
2841 | */ | - |
2842 | | - |
2843 | | - |
2844 | /*! | - |
2845 | \fn int QTextTableFormat::columns() const | - |
2846 | | - |
2847 | Returns the number of columns specified by the table format. | - |
2848 | */ | - |
2849 | | - |
2850 | | - |
2851 | /*! | - |
2852 | \internal | - |
2853 | \fn void QTextTableFormat::setColumns(int columns) | - |
2854 | | - |
2855 | Sets the number of \a columns required by the table format. | - |
2856 | | - |
2857 | \sa columns() | - |
2858 | */ | - |
2859 | | - |
2860 | /*! | - |
2861 | \fn void QTextTableFormat::clearColumnWidthConstraints() | - |
2862 | | - |
2863 | Clears the column width constraints for the table. | - |
2864 | | - |
2865 | \sa columnWidthConstraints(), setColumnWidthConstraints() | - |
2866 | */ | - |
2867 | | - |
2868 | /*! | - |
2869 | \fn void QTextTableFormat::setColumnWidthConstraints(const QVector<QTextLength> &constraints) | - |
2870 | | - |
2871 | Sets the column width \a constraints for the table. | - |
2872 | | - |
2873 | \sa columnWidthConstraints(), clearColumnWidthConstraints() | - |
2874 | */ | - |
2875 | | - |
2876 | /*! | - |
2877 | \fn QVector<QTextLength> QTextTableFormat::columnWidthConstraints() const | - |
2878 | | - |
2879 | Returns a list of constraints used by this table format to control the | - |
2880 | appearance of columns in a table. | - |
2881 | | - |
2882 | \sa setColumnWidthConstraints() | - |
2883 | */ | - |
2884 | | - |
2885 | /*! | - |
2886 | \fn qreal QTextTableFormat::cellSpacing() const | - |
2887 | | - |
2888 | Returns the table's cell spacing. This describes the distance between | - |
2889 | adjacent cells. | - |
2890 | */ | - |
2891 | | - |
2892 | /*! | - |
2893 | \fn void QTextTableFormat::setCellSpacing(qreal spacing) | - |
2894 | | - |
2895 | Sets the cell \a spacing for the table. This determines the distance | - |
2896 | between adjacent cells. | - |
2897 | */ | - |
2898 | | - |
2899 | /*! | - |
2900 | \fn qreal QTextTableFormat::cellPadding() const | - |
2901 | | - |
2902 | Returns the table's cell padding. This describes the distance between | - |
2903 | the border of a cell and its contents. | - |
2904 | */ | - |
2905 | | - |
2906 | /*! | - |
2907 | \fn void QTextTableFormat::setCellPadding(qreal padding) | - |
2908 | | - |
2909 | Sets the cell \a padding for the table. This determines the distance | - |
2910 | between the border of a cell and its contents. | - |
2911 | */ | - |
2912 | | - |
2913 | /*! | - |
2914 | \fn void QTextTableFormat::setAlignment(Qt::Alignment alignment) | - |
2915 | | - |
2916 | Sets the table's \a alignment. | - |
2917 | | - |
2918 | \sa alignment() | - |
2919 | */ | - |
2920 | | - |
2921 | /*! | - |
2922 | \fn Qt::Alignment QTextTableFormat::alignment() const | - |
2923 | | - |
2924 | Returns the table's alignment. | - |
2925 | | - |
2926 | \sa setAlignment() | - |
2927 | */ | - |
2928 | | - |
2929 | /*! | - |
2930 | \fn void QTextTableFormat::setHeaderRowCount(int count) | - |
2931 | \since 4.2 | - |
2932 | | - |
2933 | Declares the first \a count rows of the table as table header. | - |
2934 | The table header rows get repeated when a table is broken | - |
2935 | across a page boundary. | - |
2936 | */ | - |
2937 | | - |
2938 | /*! | - |
2939 | \fn int QTextTableFormat::headerRowCount() const | - |
2940 | \since 4.2 | - |
2941 | | - |
2942 | Returns the number of rows in the table that define the header. | - |
2943 | | - |
2944 | \sa setHeaderRowCount() | - |
2945 | */ | - |
2946 | | - |
2947 | /*! | - |
2948 | \fn void QTextFormat::setBackground(const QBrush &brush) | - |
2949 | | - |
2950 | Sets the brush use to paint the document's background to the | - |
2951 | \a brush specified. | - |
2952 | | - |
2953 | \sa background(), clearBackground(), setForeground() | - |
2954 | */ | - |
2955 | | - |
2956 | /*! | - |
2957 | \fn QColor QTextFormat::background() const | - |
2958 | | - |
2959 | Returns the brush used to paint the document's background. | - |
2960 | | - |
2961 | \sa setBackground(), clearBackground(), foreground() | - |
2962 | */ | - |
2963 | | - |
2964 | /*! | - |
2965 | \fn void QTextFormat::clearBackground() | - |
2966 | | - |
2967 | Clears the brush used to paint the document's background. The default | - |
2968 | brush will be used. | - |
2969 | | - |
2970 | \sa background(), setBackground(), clearForeground() | - |
2971 | */ | - |
2972 | | - |
2973 | | - |
2974 | /*! | - |
2975 | \class QTextImageFormat | - |
2976 | \reentrant | - |
2977 | | - |
2978 | \brief The QTextImageFormat class provides formatting information for | - |
2979 | images in a QTextDocument. | - |
2980 | \inmodule QtGui | - |
2981 | | - |
2982 | \ingroup richtext-processing | - |
2983 | \ingroup shared | - |
2984 | | - |
2985 | Inline images are represented by an object replacement character | - |
2986 | (0xFFFC in Unicode) which has an associated QTextImageFormat. The | - |
2987 | image format specifies a name with setName() that is used to | - |
2988 | locate the image. The size of the rectangle that the image will | - |
2989 | occupy is specified using setWidth() and setHeight(). | - |
2990 | | - |
2991 | Images can be supplied in any format for which Qt has an image | - |
2992 | reader, so SVG drawings can be included alongside PNG, TIFF and | - |
2993 | other bitmap formats. | - |
2994 | | - |
2995 | \sa QImage, QImageReader | - |
2996 | */ | - |
2997 | | - |
2998 | /*! | - |
2999 | \fn QTextImageFormat::QTextImageFormat() | - |
3000 | | - |
3001 | Creates a new image format object. | - |
3002 | */ | - |
3003 | QTextImageFormat::QTextImageFormat() : QTextCharFormat() { setObjectType(ImageObject); } executed: } Execution Count:32 | 32 |
3004 | | - |
3005 | /*! | - |
3006 | \internal | - |
3007 | \fn QTextImageFormat::QTextImageFormat(const QTextFormat &other) | - |
3008 | | - |
3009 | Creates a new image format with the same attributes as the \a given | - |
3010 | text format. | - |
3011 | */ | - |
3012 | QTextImageFormat::QTextImageFormat(const QTextFormat &fmt) | - |
3013 | : QTextCharFormat(fmt) | - |
3014 | { | - |
3015 | } executed: } Execution Count:32 | 32 |
3016 | | - |
3017 | /*! | - |
3018 | \fn bool QTextImageFormat::isValid() const | - |
3019 | | - |
3020 | Returns true if this image format is valid; otherwise returns false. | - |
3021 | */ | - |
3022 | | - |
3023 | | - |
3024 | /*! | - |
3025 | \fn void QTextImageFormat::setName(const QString &name) | - |
3026 | | - |
3027 | Sets the \a name of the image. The \a name is used to locate the image | - |
3028 | in the application's resources. | - |
3029 | | - |
3030 | \sa name() | - |
3031 | */ | - |
3032 | | - |
3033 | | - |
3034 | /*! | - |
3035 | \fn QString QTextImageFormat::name() const | - |
3036 | | - |
3037 | Returns the name of the image. The name refers to an entry in the | - |
3038 | application's resources file. | - |
3039 | | - |
3040 | \sa setName() | - |
3041 | */ | - |
3042 | | - |
3043 | /*! | - |
3044 | \fn void QTextImageFormat::setWidth(qreal width) | - |
3045 | | - |
3046 | Sets the \a width of the rectangle occupied by the image. | - |
3047 | | - |
3048 | \sa width(), setHeight() | - |
3049 | */ | - |
3050 | | - |
3051 | | - |
3052 | /*! | - |
3053 | \fn qreal QTextImageFormat::width() const | - |
3054 | | - |
3055 | Returns the width of the rectangle occupied by the image. | - |
3056 | | - |
3057 | \sa height(), setWidth() | - |
3058 | */ | - |
3059 | | - |
3060 | | - |
3061 | /*! | - |
3062 | \fn void QTextImageFormat::setHeight(qreal height) | - |
3063 | | - |
3064 | Sets the \a height of the rectangle occupied by the image. | - |
3065 | | - |
3066 | \sa height(), setWidth() | - |
3067 | */ | - |
3068 | | - |
3069 | | - |
3070 | /*! | - |
3071 | \fn qreal QTextImageFormat::height() const | - |
3072 | | - |
3073 | Returns the height of the rectangle occupied by the image. | - |
3074 | | - |
3075 | \sa width(), setHeight() | - |
3076 | */ | - |
3077 | | - |
3078 | /*! | - |
3079 | \fn void QTextCharFormat::setFontCapitalization(QFont::Capitalization capitalization) | - |
3080 | \since 4.4 | - |
3081 | | - |
3082 | Sets the capitalization of the text that apppears in this font to \a capitalization. | - |
3083 | | - |
3084 | A font's capitalization makes the text appear in the selected capitalization mode. | - |
3085 | | - |
3086 | \sa fontCapitalization() | - |
3087 | */ | - |
3088 | | - |
3089 | /*! | - |
3090 | \fn Capitalization QTextCharFormat::fontCapitalization() const | - |
3091 | \since 4.4 | - |
3092 | | - |
3093 | Returns the current capitalization type of the font. | - |
3094 | */ | - |
3095 | | - |
3096 | /*! | - |
3097 | \fn void QTextCharFormat::setFontLetterSpacingType(QFont::SpacingType letterSpacingType) | - |
3098 | \since 5.0 | - |
3099 | | - |
3100 | Sets the letter spacing type of this format to \a letterSpacingType. | - |
3101 | | - |
3102 | \sa fontLetterSpacingType() | - |
3103 | \sa setFontLetterSpacing() | - |
3104 | \sa fontLetterSpacing() | - |
3105 | */ | - |
3106 | | - |
3107 | /*! | - |
3108 | \fn QFont::SpacingType QTextCharFormat::fontLetterSpacingType() const | - |
3109 | \since 5.0 | - |
3110 | | - |
3111 | Returns the letter spacing type of this format.. | - |
3112 | | - |
3113 | \sa setFontLetterSpacingType() | - |
3114 | \sa setFontLetterSpacing() | - |
3115 | \sa fontLetterSpacing() | - |
3116 | */ | - |
3117 | | - |
3118 | /*! | - |
3119 | \fn void QTextCharFormat::setFontLetterSpacing(qreal spacing) | - |
3120 | \since 4.4 | - |
3121 | | - |
3122 | Sets the letter spacing of this format to the given \a spacing. The meaning of the value | - |
3123 | depends on the font letter spacing type. | - |
3124 | | - |
3125 | For percentage spacing a value of 100 indicates default spacing; a value of 200 doubles the | - |
3126 | amount of space a letter takes. | - |
3127 | | - |
3128 | \sa fontLetterSpacing() | - |
3129 | \sa setFontLetterSpacingType() | - |
3130 | \sa fontLetterSpacingType() | - |
3131 | */ | - |
3132 | | - |
3133 | /*! | - |
3134 | \fn qreal QTextCharFormat::fontLetterSpacing() const | - |
3135 | \since 4.4 | - |
3136 | | - |
3137 | Returns the current letter spacing. | - |
3138 | | - |
3139 | \sa setFontLetterSpacing() | - |
3140 | \sa setFontLetterSpacingType() | - |
3141 | \sa fontLetterSpacingType() | - |
3142 | */ | - |
3143 | | - |
3144 | /*! | - |
3145 | \fn void QTextCharFormat::setFontWordSpacing(qreal spacing) | - |
3146 | \since 4.4 | - |
3147 | | - |
3148 | Sets the word spacing of this format to the given \a spacing, in pixels. | - |
3149 | | - |
3150 | \sa fontWordSpacing() | - |
3151 | */ | - |
3152 | | - |
3153 | /*! | - |
3154 | \fn qreal QTextCharFormat::fontWordSpacing() const | - |
3155 | \since 4.4 | - |
3156 | | - |
3157 | Returns the current word spacing value. | - |
3158 | */ | - |
3159 | | - |
3160 | /*! | - |
3161 | \fn void QTextCharFormat::setFontStretch(int factor) | - |
3162 | \since 5.0 | - |
3163 | | - |
3164 | Sets the stretch factor for the font to \a factor. | - |
3165 | | - |
3166 | The stretch factor changes the width of all characters in the font by factor percent. For example, setting \a factor to 150 results in all characters in the font being 1.5 times (ie. 150%) wider. The default stretch factor is 100. The minimum stretch factor is 1, and the maximum stretch factor is 4000. | - |
3167 | | - |
3168 | The stretch factor is only applied to outline fonts. The stretch factor is ignored for bitmap fonts. | - |
3169 | | - |
3170 | \sa fontStretch() | - |
3171 | */ | - |
3172 | | - |
3173 | /*! | - |
3174 | \fn int QTextCharFormat::fontStretch() const | - |
3175 | \since 5.0 | - |
3176 | | - |
3177 | Returns the current font stretching. | - |
3178 | \sa setFontStretch() | - |
3179 | */ | - |
3180 | | - |
3181 | /*! | - |
3182 | \fn qreal QTextTableCellFormat::topPadding() const | - |
3183 | \since 4.4 | - |
3184 | | - |
3185 | Gets the top padding of the table cell. | - |
3186 | | - |
3187 | \sa setTopPadding(), leftPadding(), rightPadding(), bottomPadding() | - |
3188 | */ | - |
3189 | | - |
3190 | /*! | - |
3191 | \fn qreal QTextTableCellFormat::bottomPadding() const | - |
3192 | \since 4.4 | - |
3193 | | - |
3194 | Gets the bottom padding of the table cell. | - |
3195 | | - |
3196 | \sa setBottomPadding(), leftPadding(), rightPadding(), topPadding() | - |
3197 | */ | - |
3198 | | - |
3199 | /*! | - |
3200 | \fn qreal QTextTableCellFormat::leftPadding() const | - |
3201 | \since 4.4 | - |
3202 | | - |
3203 | Gets the left padding of the table cell. | - |
3204 | | - |
3205 | \sa setLeftPadding(), rightPadding(), topPadding(), bottomPadding() | - |
3206 | */ | - |
3207 | | - |
3208 | /*! | - |
3209 | \fn qreal QTextTableCellFormat::rightPadding() const | - |
3210 | \since 4.4 | - |
3211 | | - |
3212 | Gets the right padding of the table cell. | - |
3213 | | - |
3214 | \sa setRightPadding(), leftPadding(), topPadding(), bottomPadding() | - |
3215 | */ | - |
3216 | | - |
3217 | /*! | - |
3218 | \fn void QTextTableCellFormat::setTopPadding(qreal padding) | - |
3219 | \since 4.4 | - |
3220 | | - |
3221 | Sets the top \a padding of the table cell. | - |
3222 | | - |
3223 | \sa topPadding(), setLeftPadding(), setRightPadding(), setBottomPadding() | - |
3224 | */ | - |
3225 | | - |
3226 | /*! | - |
3227 | \fn void QTextTableCellFormat::setBottomPadding(qreal padding) | - |
3228 | \since 4.4 | - |
3229 | | - |
3230 | Sets the bottom \a padding of the table cell. | - |
3231 | | - |
3232 | \sa bottomPadding(), setLeftPadding(), setRightPadding(), setTopPadding() | - |
3233 | */ | - |
3234 | | - |
3235 | /*! | - |
3236 | \fn void QTextTableCellFormat::setLeftPadding(qreal padding) | - |
3237 | \since 4.4 | - |
3238 | | - |
3239 | Sets the left \a padding of the table cell. | - |
3240 | | - |
3241 | \sa leftPadding(), setRightPadding(), setTopPadding(), setBottomPadding() | - |
3242 | */ | - |
3243 | | - |
3244 | /*! | - |
3245 | \fn void QTextTableCellFormat::setRightPadding(qreal padding) | - |
3246 | \since 4.4 | - |
3247 | | - |
3248 | Sets the right \a padding of the table cell. | - |
3249 | | - |
3250 | \sa rightPadding(), setLeftPadding(), setTopPadding(), setBottomPadding() | - |
3251 | */ | - |
3252 | | - |
3253 | /*! | - |
3254 | \fn void QTextTableCellFormat::setPadding(qreal padding) | - |
3255 | \since 4.4 | - |
3256 | | - |
3257 | Sets the left, right, top, and bottom \a padding of the table cell. | - |
3258 | | - |
3259 | \sa setLeftPadding(), setRightPadding(), setTopPadding(), setBottomPadding() | - |
3260 | */ | - |
3261 | | - |
3262 | /*! | - |
3263 | \fn bool QTextTableCellFormat::isValid() const | - |
3264 | \since 4.4 | - |
3265 | | - |
3266 | Returns true if this table cell format is valid; otherwise returns false. | - |
3267 | */ | - |
3268 | | - |
3269 | /*! | - |
3270 | \fn QTextTableCellFormat::QTextTableCellFormat() | - |
3271 | \since 4.4 | - |
3272 | | - |
3273 | Constructs a new table cell format object. | - |
3274 | */ | - |
3275 | QTextTableCellFormat::QTextTableCellFormat() | - |
3276 | : QTextCharFormat() | - |
3277 | { | - |
3278 | setObjectType(TableCellObject); never executed (the execution status of this line is deduced): setObjectType(TableCellObject); | - |
3279 | } | 0 |
3280 | | - |
3281 | /*! | - |
3282 | \internal | - |
3283 | \fn QTextTableCellFormat::QTextTableCellFormat(const QTextFormat &other) | - |
3284 | | - |
3285 | Creates a new table cell format with the same attributes as the \a given | - |
3286 | text format. | - |
3287 | */ | - |
3288 | QTextTableCellFormat::QTextTableCellFormat(const QTextFormat &fmt) | - |
3289 | : QTextCharFormat(fmt) | - |
3290 | { | - |
3291 | } executed: } Execution Count:217 | 217 |
3292 | | - |
3293 | /*! | - |
3294 | \class QTextTableCellFormat | - |
3295 | \reentrant | - |
3296 | \since 4.4 | - |
3297 | | - |
3298 | \brief The QTextTableCellFormat class provides formatting information for | - |
3299 | table cells in a QTextDocument. | - |
3300 | \inmodule QtGui | - |
3301 | | - |
3302 | \ingroup richtext-processing | - |
3303 | \ingroup shared | - |
3304 | | - |
3305 | The table cell format of a table cell in a document specifies the visual | - |
3306 | properties of the table cell. | - |
3307 | | - |
3308 | The padding properties of a table cell are controlled by setLeftPadding(), | - |
3309 | setRightPadding(), setTopPadding(), and setBottomPadding(). All the paddings | - |
3310 | can be set at once using setPadding(). | - |
3311 | | - |
3312 | \sa QTextFormat, QTextBlockFormat, QTextTableFormat, QTextCharFormat | - |
3313 | */ | - |
3314 | | - |
3315 | // ------------------------------------------------------ | - |
3316 | | - |
3317 | | - |
3318 | QTextFormatCollection::QTextFormatCollection(const QTextFormatCollection &rhs) | - |
3319 | { | - |
3320 | formats = rhs.formats; never executed (the execution status of this line is deduced): formats = rhs.formats; | - |
3321 | objFormats = rhs.objFormats; never executed (the execution status of this line is deduced): objFormats = rhs.objFormats; | - |
3322 | } | 0 |
3323 | | - |
3324 | QTextFormatCollection &QTextFormatCollection::operator=(const QTextFormatCollection &rhs) | - |
3325 | { | - |
3326 | formats = rhs.formats; executed (the execution status of this line is deduced): formats = rhs.formats; | - |
3327 | objFormats = rhs.objFormats; executed (the execution status of this line is deduced): objFormats = rhs.objFormats; | - |
3328 | return *this; executed: return *this; Execution Count:1199 | 1199 |
3329 | } | - |
3330 | | - |
3331 | QTextFormatCollection::~QTextFormatCollection() | - |
3332 | { | - |
3333 | } | - |
3334 | | - |
3335 | int QTextFormatCollection::indexForFormat(const QTextFormat &format) | - |
3336 | { | - |
3337 | uint hash = getHash(format.d, format.format_type); executed (the execution status of this line is deduced): uint hash = getHash(format.d, format.format_type); | - |
3338 | QMultiHash<uint, int>::const_iterator i = hashes.constFind(hash); executed (the execution status of this line is deduced): QMultiHash<uint, int>::const_iterator i = hashes.constFind(hash); | - |
3339 | while (i != hashes.constEnd() && i.key() == hash) { evaluated: i != hashes.constEnd() yes Evaluation Count:47318 | yes Evaluation Count:9490 |
evaluated: i.key() == hash yes Evaluation Count:45172 | yes Evaluation Count:2146 |
| 2146-47318 |
3340 | if (formats.value(i.value()) == format) { evaluated: formats.value(i.value()) == format yes Evaluation Count:41795 | yes Evaluation Count:3377 |
| 3377-41795 |
3341 | return i.value(); executed: return i.value(); Execution Count:41795 | 41795 |
3342 | } | - |
3343 | ++i; executed (the execution status of this line is deduced): ++i; | - |
3344 | } executed: } Execution Count:3377 | 3377 |
3345 | | - |
3346 | int idx = formats.size(); executed (the execution status of this line is deduced): int idx = formats.size(); | - |
3347 | formats.append(format); executed (the execution status of this line is deduced): formats.append(format); | - |
3348 | | - |
3349 | QT_TRY{ partially evaluated: true yes Evaluation Count:11636 | no Evaluation Count:0 |
| 0-11636 |
3350 | QTextFormat &f = formats.last(); executed (the execution status of this line is deduced): QTextFormat &f = formats.last(); | - |
3351 | if (!f.d) evaluated: !f.d yes Evaluation Count:6280 | yes Evaluation Count:5356 |
| 5356-6280 |
3352 | f.d = new QTextFormatPrivate; executed: f.d = new QTextFormatPrivate; Execution Count:6280 | 6280 |
3353 | f.d->resolveFont(defaultFnt); executed (the execution status of this line is deduced): f.d->resolveFont(defaultFnt); | - |
3354 | | - |
3355 | if (!hashes.contains(hash, idx)) evaluated: !hashes.contains(hash, idx) yes Evaluation Count:8482 | yes Evaluation Count:3154 |
| 3154-8482 |
3356 | hashes.insert(hash, idx); executed: hashes.insert(hash, idx); Execution Count:8482 | 8482 |
3357 | | - |
3358 | } QT_CATCH(...) { executed: } Execution Count:11636 | 11636 |
3359 | formats.pop_back(); never executed (the execution status of this line is deduced): formats.pop_back(); | - |
3360 | QT_RETHROW; never executed (the execution status of this line is deduced): qt_noop(); | - |
3361 | } | 0 |
3362 | return idx; executed: return idx; Execution Count:11636 | 11636 |
3363 | } | - |
3364 | | - |
3365 | bool QTextFormatCollection::hasFormatCached(const QTextFormat &format) const | - |
3366 | { | - |
3367 | uint hash = getHash(format.d, format.format_type); never executed (the execution status of this line is deduced): uint hash = getHash(format.d, format.format_type); | - |
3368 | QMultiHash<uint, int>::const_iterator i = hashes.constFind(hash); never executed (the execution status of this line is deduced): QMultiHash<uint, int>::const_iterator i = hashes.constFind(hash); | - |
3369 | while (i != hashes.constEnd() && i.key() == hash) { never evaluated: i != hashes.constEnd() never evaluated: i.key() == hash | 0 |
3370 | if (formats.value(i.value()) == format) { never evaluated: formats.value(i.value()) == format | 0 |
3371 | return true; never executed: return true; | 0 |
3372 | } | - |
3373 | ++i; never executed (the execution status of this line is deduced): ++i; | - |
3374 | } | 0 |
3375 | return false; never executed: return false; | 0 |
3376 | } | - |
3377 | | - |
3378 | QTextFormat QTextFormatCollection::objectFormat(int objectIndex) const | - |
3379 | { | - |
3380 | if (objectIndex == -1) evaluated: objectIndex == -1 yes Evaluation Count:1 | yes Evaluation Count:5580 |
| 1-5580 |
3381 | return QTextFormat(); executed: return QTextFormat(); Execution Count:1 | 1 |
3382 | return format(objFormats.at(objectIndex)); executed: return format(objFormats.at(objectIndex)); Execution Count:5580 | 5580 |
3383 | } | - |
3384 | | - |
3385 | void QTextFormatCollection::setObjectFormat(int objectIndex, const QTextFormat &f) | - |
3386 | { | - |
3387 | const int formatIndex = indexForFormat(f); never executed (the execution status of this line is deduced): const int formatIndex = indexForFormat(f); | - |
3388 | objFormats[objectIndex] = formatIndex; never executed (the execution status of this line is deduced): objFormats[objectIndex] = formatIndex; | - |
3389 | } | 0 |
3390 | | - |
3391 | int QTextFormatCollection::objectFormatIndex(int objectIndex) const | - |
3392 | { | - |
3393 | if (objectIndex == -1) evaluated: objectIndex == -1 yes Evaluation Count:1 | yes Evaluation Count:106 |
| 1-106 |
3394 | return -1; executed: return -1; Execution Count:1 | 1 |
3395 | return objFormats.at(objectIndex); executed: return objFormats.at(objectIndex); Execution Count:106 | 106 |
3396 | } | - |
3397 | | - |
3398 | void QTextFormatCollection::setObjectFormatIndex(int objectIndex, int formatIndex) | - |
3399 | { | - |
3400 | objFormats[objectIndex] = formatIndex; executed (the execution status of this line is deduced): objFormats[objectIndex] = formatIndex; | - |
3401 | } executed: } Execution Count:105 | 105 |
3402 | | - |
3403 | int QTextFormatCollection::createObjectIndex(const QTextFormat &f) | - |
3404 | { | - |
3405 | const int objectIndex = objFormats.size(); executed (the execution status of this line is deduced): const int objectIndex = objFormats.size(); | - |
3406 | objFormats.append(indexForFormat(f)); executed (the execution status of this line is deduced): objFormats.append(indexForFormat(f)); | - |
3407 | return objectIndex; executed: return objectIndex; Execution Count:2213 | 2213 |
3408 | } | - |
3409 | | - |
3410 | QTextFormat QTextFormatCollection::format(int idx) const | - |
3411 | { | - |
3412 | if (idx < 0 || idx >= formats.count()) partially evaluated: idx < 0 no Evaluation Count:0 | yes Evaluation Count:164156 |
partially evaluated: idx >= formats.count() no Evaluation Count:0 | yes Evaluation Count:164156 |
| 0-164156 |
3413 | return QTextFormat(); never executed: return QTextFormat(); | 0 |
3414 | | - |
3415 | return formats.at(idx); executed: return formats.at(idx); Execution Count:164156 | 164156 |
3416 | } | - |
3417 | | - |
3418 | void QTextFormatCollection::setDefaultFont(const QFont &f) | - |
3419 | { | - |
3420 | defaultFnt = f; executed (the execution status of this line is deduced): defaultFnt = f; | - |
3421 | for (int i = 0; i < formats.count(); ++i) evaluated: i < formats.count() yes Evaluation Count:1009 | yes Evaluation Count:384 |
| 384-1009 |
3422 | if (formats[i].d) partially evaluated: formats[i].d yes Evaluation Count:1009 | no Evaluation Count:0 |
| 0-1009 |
3423 | formats[i].d->resolveFont(defaultFnt); executed: formats[i].d->resolveFont(defaultFnt); Execution Count:1009 | 1009 |
3424 | } executed: } Execution Count:384 | 384 |
3425 | | - |
3426 | #ifndef QT_NO_DEBUG_STREAM | - |
3427 | QDebug operator<<(QDebug dbg, const QTextLength &l) | - |
3428 | { | - |
3429 | dbg.nospace() << "QTextLength(QTextLength::Type(" << l.type() << "))"; executed (the execution status of this line is deduced): dbg.nospace() << "QTextLength(QTextLength::Type(" << l.type() << "))"; | - |
3430 | return dbg.space(); executed: return dbg.space(); Execution Count:1 | 1 |
3431 | } | - |
3432 | | - |
3433 | QDebug operator<<(QDebug dbg, const QTextFormat &f) | - |
3434 | { | - |
3435 | dbg.nospace() << "QTextFormat(QTextFormat::FormatType(" << f.type() << "))"; executed (the execution status of this line is deduced): dbg.nospace() << "QTextFormat(QTextFormat::FormatType(" << f.type() << "))"; | - |
3436 | return dbg.space(); executed: return dbg.space(); Execution Count:1 | 1 |
3437 | } | - |
3438 | | - |
3439 | #endif | - |
3440 | | - |
3441 | QT_END_NAMESPACE | - |
3442 | | - |
| | |