qtextformat.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/text/qtextformat.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4QTextLength::operator QVariant() const-
5{-
6 return
never executed: return QVariant(QVariant::TextLength, this);
QVariant(QVariant::TextLength, this);
never executed: return QVariant(QVariant::TextLength, this);
0
7}-
8-
9-
10QDataStream &operator<<(QDataStream &stream, const QTextLength &length)-
11{-
12 return
never executed: return stream << qint32(length.lengthType) << double(length.fixedValueOrPercentage);
stream << qint32(length.lengthType) << double(length.fixedValueOrPercentage);
never executed: return stream << qint32(length.lengthType) << double(length.fixedValueOrPercentage);
0
13}-
14-
15QDataStream &operator>>(QDataStream &stream, QTextLength &length)-
16{-
17 qint32 type;-
18 double fixedValueOrPercentage;-
19 stream >> type >> fixedValueOrPercentage;-
20 length.fixedValueOrPercentage = fixedValueOrPercentage;-
21 length.lengthType = QTextLength::Type(type);-
22 return
never executed: return stream;
stream;
never executed: return stream;
0
23}-
24-
25-
26class QTextFormatPrivate : public QSharedData-
27{-
28public:-
29 QTextFormatPrivate() : hashDirty(true), fontDirty(true), hashValue(0) {}
never executed: end of block
0
30-
31 struct Property-
32 {-
33 inline Property(qint32 k, const QVariant &v) : key(k), value(v) {}
never executed: end of block
0
34 inline Property() {}-
35-
36 qint32 key;-
37 QVariant value;-
38-
39 inline bool operator==(const Property &other) const-
40 { return
never executed: return key == other.key && value == other.value;
key == other.key && value == other.value;
never executed: return key == other.key && value == other.value;
}
0
41 inline bool operator!=(const Property &other) const-
42 { return
never executed: return key != other.key || value != other.value;
key != other.key || value != other.value;
never executed: return key != other.key || value != other.value;
}
0
43 };-
44-
45 inline uint hash() const-
46 {-
47 if (!hashDirty
!hashDirtyDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
48 return
never executed: return hashValue;
hashValue;
never executed: return hashValue;
0
49 return
never executed: return recalcHash();
recalcHash();
never executed: return recalcHash();
0
50 }-
51-
52 inline bool operator==(const QTextFormatPrivate &rhs) const {-
53 if (hash() != rhs.hash()
hash() != rhs.hash()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
54 return
never executed: return false;
false;
never executed: return false;
0
55-
56 return
never executed: return props == rhs.props;
props == rhs.props;
never executed: return props == rhs.props;
0
57 }-
58-
59 inline void insertProperty(qint32 key, const QVariant &value)-
60 {-
61 hashDirty = true;-
62 if (key >= QTextFormat::FirstFontProperty
key >= QTextFo...stFontPropertyDescription
TRUEnever evaluated
FALSEnever evaluated
&& key <= QTextFormat::LastFontProperty
key <= QTextFo...stFontPropertyDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
63 fontDirty = true;
never executed: fontDirty = true;
0
64 for (int i = 0; i < props.count()
i < props.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
65 if (props.at(i).key == key
props.at(i).key == keyDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
66 props[i].value = value;-
67 return;
never executed: return;
0
68 }-
69 props.append(Property(key, value));-
70 }
never executed: end of block
0
71-
72 inline void clearProperty(qint32 key)-
73 {-
74 for (int i = 0; i < props.count()
i < props.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
75 if (props.at(i).key == key
props.at(i).key == keyDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
76 hashDirty = true;-
77 if (key >= QTextFormat::FirstFontProperty
key >= QTextFo...stFontPropertyDescription
TRUEnever evaluated
FALSEnever evaluated
&& key <= QTextFormat::LastFontProperty
key <= QTextFo...stFontPropertyDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
78 fontDirty = true;
never executed: fontDirty = true;
0
79 props.remove(i);-
80 return;
never executed: return;
0
81 }-
82 }
never executed: end of block
0
83-
84 inline int propertyIndex(qint32 key) const-
85 {-
86 for (int i = 0; i < props.count()
i < props.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
87 if (props.at(i).key == key
props.at(i).key == keyDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
88 return
never executed: return i;
i;
never executed: return i;
0
89 return
never executed: return -1;
-1;
never executed: return -1;
0
90 }-
91-
92 inline QVariant property(qint32 key) const-
93 {-
94 const int idx = propertyIndex(key);-
95 if (idx < 0
idx < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
96 return
never executed: return QVariant();
QVariant();
never executed: return QVariant();
0
97 return
never executed: return props.at(idx).value;
props.at(idx).value;
never executed: return props.at(idx).value;
0
98 }-
99-
100 inline bool hasProperty(qint32 key) const-
101 { return
never executed: return propertyIndex(key) != -1;
propertyIndex(key) != -1;
never executed: return propertyIndex(key) != -1;
}
0
102-
103 void resolveFont(const QFont &defaultFont);-
104-
105 inline const QFont &font() const {-
106 if (fontDirty
fontDirtyDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
107 recalcFont();
never executed: recalcFont();
0
108 return
never executed: return fnt;
fnt;
never executed: return fnt;
0
109 }-
110-
111 QVector<Property> props;-
112private:-
113-
114 uint recalcHash() const;-
115 void recalcFont() const;-
116-
117 mutable bool hashDirty;-
118 mutable bool fontDirty;-
119 mutable uint hashValue;-
120 mutable QFont fnt;-
121-
122 friend QDataStream &operator<<(QDataStream &, const QTextFormat &);-
123 friend QDataStream &operator>>(QDataStream &, QTextFormat &);-
124};-
125template<> class QTypeInfo<QTextFormatPrivate::Property > { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isRelocatable = !isStatic || ((Q_MOVABLE_TYPE) & Q_RELOCATABLE_TYPE), isLarge = (sizeof(QTextFormatPrivate::Property)>sizeof(void*)), isPointer = false, isIntegral = QtPrivate::is_integral< QTextFormatPrivate::Property >::value, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0), sizeOf = sizeof(QTextFormatPrivate::Property) }; static inline const char *name() { return "QTextFormatPrivate::Property"; } };-
126-
127static inline uint hash(const QColor &color)-
128{-
129 return
never executed: return (color.isValid()) ? color.rgba() : 0x234109;
(color.isValid()) ? color.rgba() : 0x234109;
never executed: return (color.isValid()) ? color.rgba() : 0x234109;
0
130}-
131-
132static inline uint hash(const QPen &pen)-
133{-
134 return
never executed: return hash(pen.color()) + qHash(pen.widthF());
hash(pen.color()) + qHash(pen.widthF());
never executed: return hash(pen.color()) + qHash(pen.widthF());
0
135}-
136-
137static inline uint hash(const QBrush &brush)-
138{-
139 return
never executed: return hash(brush.color()) + (brush.style() << 3);
hash(brush.color()) + (brush.style() << 3);
never executed: return hash(brush.color()) + (brush.style() << 3);
0
140}-
141-
142static inline uint variantHash(const QVariant &variant)-
143{-
144-
145 switch (variant.userType()) {-
146 case
never executed: case QVariant::String:
QVariant::String:
never executed: case QVariant::String:
return
never executed: return qHash(variant.toString());
qHash(variant.toString());
never executed: return qHash(variant.toString());
0
147 case
never executed: case QVariant::Double:
QVariant::Double:
never executed: case QVariant::Double:
return
never executed: return qHash(variant.toDouble());
qHash(variant.toDouble());
never executed: return qHash(variant.toDouble());
0
148 case
never executed: case QVariant::Int:
QVariant::Int:
never executed: case QVariant::Int:
return
never executed: return 0x811890 + variant.toInt();
0x811890 + variant.toInt();
never executed: return 0x811890 + variant.toInt();
0
149 case
never executed: case QVariant::Brush:
QVariant::Brush:
never executed: case QVariant::Brush:
0
150 return
never executed: return 0x01010101 + hash(qvariant_cast<QBrush>(variant));
0x01010101 + hash(qvariant_cast<QBrush>(variant));
never executed: return 0x01010101 + hash(qvariant_cast<QBrush>(variant));
0
151 case
never executed: case QVariant::Bool:
QVariant::Bool:
never executed: case QVariant::Bool:
return
never executed: return 0x371818 + variant.toBool();
0x371818 + variant.toBool();
never executed: return 0x371818 + variant.toBool();
0
152 case
never executed: case QVariant::Pen:
QVariant::Pen:
never executed: case QVariant::Pen:
return
never executed: return 0x02020202 + hash(qvariant_cast<QPen>(variant));
0x02020202 + hash(qvariant_cast<QPen>(variant));
never executed: return 0x02020202 + hash(qvariant_cast<QPen>(variant));
0
153 case
never executed: case QVariant::List:
QVariant::List:
never executed: case QVariant::List:
0
154 return
never executed: return 0x8377 + qvariant_cast<QVariantList>(variant).count();
0x8377 + qvariant_cast<QVariantList>(variant).count();
never executed: return 0x8377 + qvariant_cast<QVariantList>(variant).count();
0
155 case
never executed: case QVariant::Color:
QVariant::Color:
never executed: case QVariant::Color:
return
never executed: return hash(qvariant_cast<QColor>(variant));
hash(qvariant_cast<QColor>(variant));
never executed: return hash(qvariant_cast<QColor>(variant));
0
156 case
never executed: case QVariant::TextLength:
QVariant::TextLength:
never executed: case QVariant::TextLength:
0
157 return
never executed: return 0x377 + hash(qvariant_cast<QTextLength>(variant).rawValue());
0x377 + hash(qvariant_cast<QTextLength>(variant).rawValue());
never executed: return 0x377 + hash(qvariant_cast<QTextLength>(variant).rawValue());
0
158 case
never executed: case QMetaType::Float:
QMetaType::Float:
never executed: case QMetaType::Float:
return
never executed: return qHash(variant.toFloat());
qHash(variant.toFloat());
never executed: return qHash(variant.toFloat());
0
159 case
never executed: case QVariant::Invalid:
QVariant::Invalid:
never executed: case QVariant::Invalid:
return
never executed: return 0;
0;
never executed: return 0;
0
160 default
never executed: default:
:
never executed: default:
break;
never executed: break;
0
161 }-
162 return
never executed: return qHash(variant.typeName());
qHash(variant.typeName());
never executed: return qHash(variant.typeName());
0
163}-
164-
165static inline int getHash(const QTextFormatPrivate *d, int format)-
166{-
167 return
never executed: return (d ? d->hash() : 0) + format;
(d ? d->hash() : 0) + format;
never executed: return (d ? d->hash() : 0) + format;
0
168}-
169-
170uint QTextFormatPrivate::recalcHash() const-
171{-
172 hashValue = 0;-
173 for (QVector<Property>::ConstIterator it = props.constBegin(); it != props.constEnd()
it != props.constEnd()Description
TRUEnever evaluated
FALSEnever evaluated
; ++it)
0
174 hashValue += (static_cast<quint32>(it->key) << 16) + variantHash(it->value);
never executed: hashValue += (static_cast<quint32>(it->key) << 16) + variantHash(it->value);
0
175-
176 hashDirty = false;-
177-
178 return
never executed: return hashValue;
hashValue;
never executed: return hashValue;
0
179}-
180-
181void QTextFormatPrivate::resolveFont(const QFont &defaultFont)-
182{-
183 recalcFont();-
184 const uint oldMask = fnt.resolve();-
185 fnt = fnt.resolve(defaultFont);-
186-
187 if (hasProperty(QTextFormat::FontSizeAdjustment)
hasProperty(QT...izeAdjustment)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
188 const qreal scaleFactors[7] = {qreal(0.7), qreal(0.8), qreal(1.0), qreal(1.2), qreal(1.5), qreal(2), qreal(2.4)};-
189-
190 const int htmlFontSize = qBound(0, property(QTextFormat::FontSizeAdjustment).toInt() + 3 - 1, 6);-
191-
192-
193 if (defaultFont.pointSize() <= 0
defaultFont.pointSize() <= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
194 qreal pixelSize = scaleFactors[htmlFontSize] * defaultFont.pixelSize();-
195 fnt.setPixelSize(qRound(pixelSize));-
196 }
never executed: end of block
else {
0
197 qreal pointSize = scaleFactors[htmlFontSize] * defaultFont.pointSizeF();-
198 fnt.setPointSizeF(pointSize);-
199 }
never executed: end of block
0
200 }-
201-
202 fnt.resolve(oldMask);-
203}
never executed: end of block
0
204-
205void QTextFormatPrivate::recalcFont() const-
206{-
207-
208 QFont f;-
209-
210 bool hasSpacingInformation = false;-
211 QFont::SpacingType spacingType = QFont::PercentageSpacing;-
212 qreal letterSpacing = 0.0;-
213-
214 for (int i = 0; i < props.count()
i < props.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
215 switch (props.at(i).key) {-
216 case
never executed: case QTextFormat::FontFamily:
QTextFormat::FontFamily:
never executed: case QTextFormat::FontFamily:
0
217 f.setFamily(props.at(i).value.toString());-
218 break;
never executed: break;
0
219 case
never executed: case QTextFormat::FontPointSize:
QTextFormat::FontPointSize:
never executed: case QTextFormat::FontPointSize:
0
220 f.setPointSizeF(props.at(i).value.toReal());-
221 break;
never executed: break;
0
222 case
never executed: case QTextFormat::FontPixelSize:
QTextFormat::FontPixelSize:
never executed: case QTextFormat::FontPixelSize:
0
223 f.setPixelSize(props.at(i).value.toInt());-
224 break;
never executed: break;
0
225 case
never executed: case QTextFormat::FontWeight:
QTextFormat::FontWeight:
never executed: case QTextFormat::FontWeight:
{
0
226 const QVariant weightValue = props.at(i).value;-
227 int weight = weightValue.toInt();-
228 if (weight >= 0
weight >= 0Description
TRUEnever evaluated
FALSEnever evaluated
&& weightValue.isValid()
weightValue.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
229 f.setWeight(weight);
never executed: f.setWeight(weight);
0
230 break;
never executed: break;
}
0
231 case
never executed: case QTextFormat::FontItalic:
QTextFormat::FontItalic:
never executed: case QTextFormat::FontItalic:
0
232 f.setItalic(props.at(i).value.toBool());-
233 break;
never executed: break;
0
234 case
never executed: case QTextFormat::FontUnderline:
QTextFormat::FontUnderline:
never executed: case QTextFormat::FontUnderline:
0
235 if (! hasProperty(QTextFormat::TextUnderlineStyle)
! hasProperty(...nderlineStyle)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
236 f.setUnderline(props.at(i).value.toBool());
never executed: f.setUnderline(props.at(i).value.toBool());
0
237 break;
never executed: break;
0
238 case
never executed: case QTextFormat::TextUnderlineStyle:
QTextFormat::TextUnderlineStyle:
never executed: case QTextFormat::TextUnderlineStyle:
0
239 f.setUnderline(static_cast<QTextCharFormat::UnderlineStyle>(props.at(i).value.toInt()) == QTextCharFormat::SingleUnderline);-
240 break;
never executed: break;
0
241 case
never executed: case QTextFormat::FontOverline:
QTextFormat::FontOverline:
never executed: case QTextFormat::FontOverline:
0
242 f.setOverline(props.at(i).value.toBool());-
243 break;
never executed: break;
0
244 case
never executed: case QTextFormat::FontStrikeOut:
QTextFormat::FontStrikeOut:
never executed: case QTextFormat::FontStrikeOut:
0
245 f.setStrikeOut(props.at(i).value.toBool());-
246 break;
never executed: break;
0
247 case
never executed: case QTextFormat::FontLetterSpacingType:
QTextFormat::FontLetterSpacingType:
never executed: case QTextFormat::FontLetterSpacingType:
0
248 spacingType = static_cast<QFont::SpacingType>(props.at(i).value.toInt());-
249 hasSpacingInformation = true;-
250 break;
never executed: break;
0
251 case
never executed: case QTextFormat::FontLetterSpacing:
QTextFormat::FontLetterSpacing:
never executed: case QTextFormat::FontLetterSpacing:
0
252 letterSpacing = props.at(i).value.toReal();-
253 hasSpacingInformation = true;-
254 break;
never executed: break;
0
255 case
never executed: case QTextFormat::FontWordSpacing:
QTextFormat::FontWordSpacing:
never executed: case QTextFormat::FontWordSpacing:
0
256 f.setWordSpacing(props.at(i).value.toReal());-
257 break;
never executed: break;
0
258 case
never executed: case QTextFormat::FontCapitalization:
QTextFormat::FontCapitalization:
never executed: case QTextFormat::FontCapitalization:
0
259 f.setCapitalization(static_cast<QFont::Capitalization> (props.at(i).value.toInt()));-
260 break;
never executed: break;
0
261 case
never executed: case QTextFormat::FontFixedPitch:
QTextFormat::FontFixedPitch:
never executed: case QTextFormat::FontFixedPitch:
{
0
262 const bool value = props.at(i).value.toBool();-
263 if (f.fixedPitch() != value
f.fixedPitch() != valueDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
264 f.setFixedPitch(value);
never executed: f.setFixedPitch(value);
0
265 break;
never executed: break;
}
0
266 case
never executed: case QTextFormat::FontStretch:
QTextFormat::FontStretch:
never executed: case QTextFormat::FontStretch:
0
267 f.setStretch(props.at(i).value.toInt());-
268 break;
never executed: break;
0
269 case
never executed: case QTextFormat::FontStyleHint:
QTextFormat::FontStyleHint:
never executed: case QTextFormat::FontStyleHint:
0
270 f.setStyleHint(static_cast<QFont::StyleHint>(props.at(i).value.toInt()), f.styleStrategy());-
271 break;
never executed: break;
0
272 case
never executed: case QTextFormat::FontHintingPreference:
QTextFormat::FontHintingPreference:
never executed: case QTextFormat::FontHintingPreference:
0
273 f.setHintingPreference(static_cast<QFont::HintingPreference>(props.at(i).value.toInt()));-
274 break;
never executed: break;
0
275 case
never executed: case QTextFormat::FontStyleStrategy:
QTextFormat::FontStyleStrategy:
never executed: case QTextFormat::FontStyleStrategy:
0
276 f.setStyleStrategy(static_cast<QFont::StyleStrategy>(props.at(i).value.toInt()));-
277 break;
never executed: break;
0
278 case
never executed: case QTextFormat::FontKerning:
QTextFormat::FontKerning:
never executed: case QTextFormat::FontKerning:
0
279 f.setKerning(props.at(i).value.toBool());-
280 break;
never executed: break;
0
281 default
never executed: default:
:
never executed: default:
0
282 break;
never executed: break;
0
283 }-
284 }-
285-
286 if (hasSpacingInformation
hasSpacingInformationDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
287 f.setLetterSpacing(spacingType, letterSpacing);
never executed: f.setLetterSpacing(spacingType, letterSpacing);
0
288-
289 fnt = f;-
290 fontDirty = false;-
291}
never executed: end of block
0
292-
293-
294__attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &stream, const QTextFormat &fmt)-
295{-
296 stream << fmt.format_type << fmt.properties();-
297 return
never executed: return stream;
stream;
never executed: return stream;
0
298}-
299-
300__attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)-
301{-
302 QMap<qint32, QVariant> properties;-
303 stream >> fmt.format_type >> properties;-
304-
305-
306-
307 if(!fmt.d
!fmt.dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
308 fmt.d = new QTextFormatPrivate();
never executed: fmt.d = new QTextFormatPrivate();
0
309-
310 for (QMap<qint32, QVariant>::ConstIterator it = properties.constBegin();-
311 it != properties.constEnd()
it != properties.constEnd()Description
TRUEnever evaluated
FALSEnever evaluated
; ++it)
0
312 fmt.d->insertProperty(it.key(), it.value());
never executed: fmt.d->insertProperty(it.key(), it.value());
0
313-
314 return
never executed: return stream;
stream;
never executed: return stream;
0
315}-
316QTextFormat::QTextFormat()-
317 : format_type(InvalidFormat)-
318{-
319}
never executed: end of block
0
320-
321-
322-
323-
324-
325-
326QTextFormat::QTextFormat(int type)-
327 : format_type(type)-
328{-
329}
never executed: end of block
0
330QTextFormat::QTextFormat(const QTextFormat &rhs)-
331 : d(rhs.d), format_type(rhs.format_type)-
332{-
333}
never executed: end of block
0
334-
335-
336-
337-
338-
339-
340-
341QTextFormat &QTextFormat::operator=(const QTextFormat &rhs)-
342{-
343 d = rhs.d;-
344 format_type = rhs.format_type;-
345 return
never executed: return *this;
*this;
never executed: return *this;
0
346}-
347QTextFormat::~QTextFormat()-
348{-
349}-
350-
351-
352-
353-
354-
355QTextFormat::operator QVariant() const-
356{-
357 return
never executed: return QVariant(QVariant::TextFormat, this);
QVariant(QVariant::TextFormat, this);
never executed: return QVariant(QVariant::TextFormat, this);
0
358}-
359-
360-
361-
362-
363-
364void QTextFormat::merge(const QTextFormat &other)-
365{-
366 if (format_type != other.format_type
format_type !=...er.format_typeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
367 return;
never executed: return;
0
368-
369 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
370 d = other.d;-
371 return;
never executed: return;
0
372 }-
373-
374 if (!other.d
!other.dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
375 return;
never executed: return;
0
376-
377 QTextFormatPrivate *d = this->d;-
378-
379 const QVector<QTextFormatPrivate::Property> &otherProps = other.d->props;-
380 d->props.reserve(d->props.size() + otherProps.size());-
381 for (int i = 0; i < otherProps.count()
i < otherProps.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
382 const QTextFormatPrivate::Property &p = otherProps.at(i);-
383 d->insertProperty(p.key, p.value);-
384 }
never executed: end of block
0
385}
never executed: end of block
0
386-
387-
388-
389-
390-
391-
392int QTextFormat::type() const-
393{-
394 return
never executed: return format_type;
format_type;
never executed: return format_type;
0
395}-
396-
397-
398-
399-
400QTextBlockFormat QTextFormat::toBlockFormat() const-
401{-
402 return
never executed: return QTextBlockFormat(*this);
QTextBlockFormat(*this);
never executed: return QTextBlockFormat(*this);
0
403}-
404-
405-
406-
407-
408QTextCharFormat QTextFormat::toCharFormat() const-
409{-
410 return
never executed: return QTextCharFormat(*this);
QTextCharFormat(*this);
never executed: return QTextCharFormat(*this);
0
411}-
412-
413-
414-
415-
416QTextListFormat QTextFormat::toListFormat() const-
417{-
418 return
never executed: return QTextListFormat(*this);
QTextListFormat(*this);
never executed: return QTextListFormat(*this);
0
419}-
420-
421-
422-
423-
424QTextTableFormat QTextFormat::toTableFormat() const-
425{-
426 return
never executed: return QTextTableFormat(*this);
QTextTableFormat(*this);
never executed: return QTextTableFormat(*this);
0
427}-
428-
429-
430-
431-
432QTextFrameFormat QTextFormat::toFrameFormat() const-
433{-
434 return
never executed: return QTextFrameFormat(*this);
QTextFrameFormat(*this);
never executed: return QTextFrameFormat(*this);
0
435}-
436-
437-
438-
439-
440QTextImageFormat QTextFormat::toImageFormat() const-
441{-
442 return
never executed: return QTextImageFormat(*this);
QTextImageFormat(*this);
never executed: return QTextImageFormat(*this);
0
443}-
444-
445-
446-
447-
448-
449-
450QTextTableCellFormat QTextFormat::toTableCellFormat() const-
451{-
452 return
never executed: return QTextTableCellFormat(*this);
QTextTableCellFormat(*this);
never executed: return QTextTableCellFormat(*this);
0
453}-
454bool QTextFormat::boolProperty(int propertyId) const-
455{-
456 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
457 return
never executed: return false;
false;
never executed: return false;
0
458 const QVariant prop = d->property(propertyId);-
459 if (prop.userType() != QVariant::Bool
prop.userType(...QVariant::BoolDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
460 return
never executed: return false;
false;
never executed: return false;
0
461 return
never executed: return prop.toBool();
prop.toBool();
never executed: return prop.toBool();
0
462}-
463int QTextFormat::intProperty(int propertyId) const-
464{-
465-
466 int def = (
(propertyId ==...youtDirection)Description
TRUEnever evaluated
FALSEnever evaluated
propertyId == QTextFormat::LayoutDirection)
(propertyId ==...youtDirection)Description
TRUEnever evaluated
FALSEnever evaluated
? int(Qt::LayoutDirectionAuto) : 0;
0
467-
468 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
469 return
never executed: return def;
def;
never executed: return def;
0
470 const QVariant prop = d->property(propertyId);-
471 if (prop.userType() != QVariant::Int
prop.userType(... QVariant::IntDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
472 return
never executed: return def;
def;
never executed: return def;
0
473 return
never executed: return prop.toInt();
prop.toInt();
never executed: return prop.toInt();
0
474}-
475qreal QTextFormat::doubleProperty(int propertyId) const-
476{-
477 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
478 return
never executed: return 0.;
0.;
never executed: return 0.;
0
479 const QVariant prop = d->property(propertyId);-
480 if (prop.userType() != QVariant::Double
prop.userType(...ariant::DoubleDescription
TRUEnever evaluated
FALSEnever evaluated
&& prop.userType() != QMetaType::Float
prop.userType(...etaType::FloatDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
481 return
never executed: return 0.;
0.;
never executed: return 0.;
0
482 return
never executed: return qvariant_cast<qreal>(prop);
qvariant_cast<qreal>(prop);
never executed: return qvariant_cast<qreal>(prop);
0
483}-
484QString QTextFormat::stringProperty(int propertyId) const-
485{-
486 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
487 return
never executed: return QString();
QString();
never executed: return QString();
0
488 const QVariant prop = d->property(propertyId);-
489 if (prop.userType() != QVariant::String
prop.userType(...ariant::StringDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
490 return
never executed: return QString();
QString();
never executed: return QString();
0
491 return
never executed: return prop.toString();
prop.toString();
never executed: return prop.toString();
0
492}-
493QColor QTextFormat::colorProperty(int propertyId) const-
494{-
495 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
496 return
never executed: return QColor();
QColor();
never executed: return QColor();
0
497 const QVariant prop = d->property(propertyId);-
498 if (prop.userType() != QVariant::Color
prop.userType(...Variant::ColorDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
499 return
never executed: return QColor();
QColor();
never executed: return QColor();
0
500 return
never executed: return qvariant_cast<QColor>(prop);
qvariant_cast<QColor>(prop);
never executed: return qvariant_cast<QColor>(prop);
0
501}-
502QPen QTextFormat::penProperty(int propertyId) const-
503{-
504 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
505 return
never executed: return QPen(Qt::NoPen);
QPen(Qt::NoPen);
never executed: return QPen(Qt::NoPen);
0
506 const QVariant prop = d->property(propertyId);-
507 if (prop.userType() != QVariant::Pen
prop.userType(... QVariant::PenDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
508 return
never executed: return QPen(Qt::NoPen);
QPen(Qt::NoPen);
never executed: return QPen(Qt::NoPen);
0
509 return
never executed: return qvariant_cast<QPen>(prop);
qvariant_cast<QPen>(prop);
never executed: return qvariant_cast<QPen>(prop);
0
510}-
511QBrush QTextFormat::brushProperty(int propertyId) const-
512{-
513 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
514 return
never executed: return QBrush(Qt::NoBrush);
QBrush(Qt::NoBrush);
never executed: return QBrush(Qt::NoBrush);
0
515 const QVariant prop = d->property(propertyId);-
516 if (prop.userType() != QVariant::Brush
prop.userType(...Variant::BrushDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
517 return
never executed: return QBrush(Qt::NoBrush);
QBrush(Qt::NoBrush);
never executed: return QBrush(Qt::NoBrush);
0
518 return
never executed: return qvariant_cast<QBrush>(prop);
qvariant_cast<QBrush>(prop);
never executed: return qvariant_cast<QBrush>(prop);
0
519}-
520-
521-
522-
523-
524-
525-
526-
527QTextLength QTextFormat::lengthProperty(int propertyId) const-
528{-
529 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
530 return
never executed: return QTextLength();
QTextLength();
never executed: return QTextLength();
0
531 return
never executed: return qvariant_cast<QTextLength>(d->property(propertyId));
qvariant_cast<QTextLength>(d->property(propertyId));
never executed: return qvariant_cast<QTextLength>(d->property(propertyId));
0
532}-
533QVector<QTextLength> QTextFormat::lengthVectorProperty(int propertyId) const-
534{-
535 QVector<QTextLength> vector;-
536 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
537 return
never executed: return vector;
vector;
never executed: return vector;
0
538 const QVariant prop = d->property(propertyId);-
539 if (prop.userType() != QVariant::List
prop.userType(...QVariant::ListDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
540 return
never executed: return vector;
vector;
never executed: return vector;
0
541-
542 QList<QVariant> propertyList = prop.toList();-
543 for (int i=0; i<propertyList.size()
i<propertyList.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
544 QVariant var = propertyList.at(i);-
545 if (var.userType() == QVariant::TextLength
var.userType()...nt::TextLengthDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
546 vector.append(qvariant_cast<QTextLength>(var));
never executed: vector.append(qvariant_cast<QTextLength>(var));
0
547 }
never executed: end of block
0
548-
549 return
never executed: return vector;
vector;
never executed: return vector;
0
550}-
551-
552-
553-
554-
555-
556-
557QVariant QTextFormat::property(int propertyId) const-
558{-
559 return
never executed: return d ? d->property(propertyId) : QVariant();
d ? d->property(propertyId) : QVariant();
never executed: return d ? d->property(propertyId) : QVariant();
0
560}-
561-
562-
563-
564-
565-
566-
567void QTextFormat::setProperty(int propertyId, const QVariant &value)-
568{-
569 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
570 d = new QTextFormatPrivate;
never executed: d = new QTextFormatPrivate;
0
571 if (!value.isValid()
!value.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
572 clearProperty(propertyId);
never executed: clearProperty(propertyId);
0
573 else-
574 d->insertProperty(propertyId, value);
never executed: d->insertProperty(propertyId, value);
0
575}-
576-
577-
578-
579-
580-
581-
582void QTextFormat::setProperty(int propertyId, const QVector<QTextLength> &value)-
583{-
584 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
585 d = new QTextFormatPrivate;
never executed: d = new QTextFormatPrivate;
0
586 QVariantList list;-
587 const int numValues = value.size();-
588 list.reserve(numValues);-
589 for (int i = 0; i < numValues
i < numValuesDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
590 list << value.at(i);
never executed: list << value.at(i);
0
591 d->insertProperty(propertyId, list);-
592}
never executed: end of block
0
593-
594-
595-
596-
597-
598-
599void QTextFormat::clearProperty(int propertyId)-
600{-
601 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
602 return;
never executed: return;
0
603 d->clearProperty(propertyId);-
604}
never executed: end of block
0
605int QTextFormat::objectIndex() const-
606{-
607 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
608 return
never executed: return -1;
-1;
never executed: return -1;
0
609 const QVariant prop = d->property(ObjectIndex);-
610 if (prop.userType() != QVariant::Int
prop.userType(... QVariant::IntDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
611 return
never executed: return -1;
-1;
never executed: return -1;
0
612 return
never executed: return prop.toInt();
prop.toInt();
never executed: return prop.toInt();
0
613}-
614void QTextFormat::setObjectIndex(int o)-
615{-
616 if (o == -1
o == -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
617 if (d
dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
618 d->clearProperty(ObjectIndex);
never executed: d->clearProperty(ObjectIndex);
0
619 }
never executed: end of block
else {
0
620 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
621 d = new QTextFormatPrivate;
never executed: d = new QTextFormatPrivate;
0
622-
623 d->insertProperty(ObjectIndex, o);-
624 }
never executed: end of block
0
625}-
626-
627-
628-
629-
630-
631-
632-
633bool QTextFormat::hasProperty(int propertyId) const-
634{-
635 return
never executed: return d ? d->hasProperty(propertyId) : false;
d ? d->hasProperty(propertyId) : false;
never executed: return d ? d->hasProperty(propertyId) : false;
0
636}-
637QMap<int, QVariant> QTextFormat::properties() const-
638{-
639 QMap<int, QVariant> map;-
640 if (d
dDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
641 for (int i = 0; i < d->props.count()
i < d->props.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
642 map.insert(d->props.at(i).key, d->props.at(i).value);
never executed: map.insert(d->props.at(i).key, d->props.at(i).value);
0
643 }
never executed: end of block
0
644 return
never executed: return map;
map;
never executed: return map;
0
645}-
646-
647-
648-
649-
650-
651int QTextFormat::propertyCount() const-
652{-
653 return
never executed: return d ? d->props.count() : 0;
d ? d->props.count() : 0;
never executed: return d ? d->props.count() : 0;
0
654}-
655bool QTextFormat::operator==(const QTextFormat &rhs) const-
656{-
657 if (format_type != rhs.format_type
format_type != rhs.format_typeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
658 return
never executed: return false;
false;
never executed: return false;
0
659-
660 if (d == rhs.d
d == rhs.dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
661 return
never executed: return true;
true;
never executed: return true;
0
662-
663 if (d
dDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->props.isEmpty()
d->props.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
&& !rhs.d
!rhs.dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
664 return
never executed: return true;
true;
never executed: return true;
0
665-
666 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
&& rhs.d
rhs.dDescription
TRUEnever evaluated
FALSEnever evaluated
&& rhs.d->props.isEmpty()
rhs.d->props.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
667 return
never executed: return true;
true;
never executed: return true;
0
668-
669 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
|| !rhs.d
!rhs.dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
670 return
never executed: return false;
false;
never executed: return false;
0
671-
672 return
never executed: return *d == *rhs.d;
*d == *rhs.d;
never executed: return *d == *rhs.d;
0
673}-
674QTextCharFormat::QTextCharFormat() : QTextFormat(CharFormat) {}
never executed: end of block
0
675QTextCharFormat::QTextCharFormat(const QTextFormat &fmt)-
676 : QTextFormat(fmt)-
677{-
678}
never executed: end of block
0
679bool QTextCharFormat::fontUnderline() const-
680{-
681 if (hasProperty(TextUnderlineStyle)
hasProperty(Te...nderlineStyle)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
682 return
never executed: return underlineStyle() == SingleUnderline;
underlineStyle() == SingleUnderline;
never executed: return underlineStyle() == SingleUnderline;
0
683 return
never executed: return boolProperty(FontUnderline);
boolProperty(FontUnderline);
never executed: return boolProperty(FontUnderline);
0
684}-
685void QTextCharFormat::setUnderlineStyle(UnderlineStyle style)-
686{-
687 setProperty(TextUnderlineStyle, style);-
688-
689 setProperty(FontUnderline, style == SingleUnderline);-
690}
never executed: end of block
0
691QString QTextCharFormat::anchorName() const-
692{-
693 QVariant prop = property(AnchorName);-
694 if (prop.userType() == QVariant::StringList
prop.userType(...nt::StringListDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
695 return
never executed: return prop.toStringList().value(0);
prop.toStringList().value(0);
never executed: return prop.toStringList().value(0);
0
696 else if (prop.userType() != QVariant::String
prop.userType(...ariant::StringDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
697 return
never executed: return QString();
QString();
never executed: return QString();
0
698 return
never executed: return prop.toString();
prop.toString();
never executed: return prop.toString();
0
699}-
700QStringList QTextCharFormat::anchorNames() const-
701{-
702 QVariant prop = property(AnchorName);-
703 if (prop.userType() == QVariant::StringList
prop.userType(...nt::StringListDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
704 return
never executed: return prop.toStringList();
prop.toStringList();
never executed: return prop.toStringList();
0
705 else if (prop.userType() != QVariant::String
prop.userType(...ariant::StringDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
706 return
never executed: return QStringList();
QStringList();
never executed: return QStringList();
0
707 return
never executed: return QStringList(prop.toString());
QStringList(prop.toString());
never executed: return QStringList(prop.toString());
0
708}-
709void QTextCharFormat::setFont(const QFont &font)-
710{-
711 setFont(font, FontPropertiesAll);-
712}
never executed: end of block
0
713void QTextCharFormat::setFont(const QFont &font, FontPropertiesInheritanceBehavior behavior)-
714{-
715 const uint mask = behavior == FontPropertiesAll
behavior == FontPropertiesAllDescription
TRUEnever evaluated
FALSEnever evaluated
? uint(QFont::AllPropertiesResolved)
0
716 : font.resolve();-
717-
718 if (mask & QFont::FamilyResolved
mask & QFont::FamilyResolvedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
719 setFontFamily(font.family());
never executed: setFontFamily(font.family());
0
720 if (mask & QFont::SizeResolved
mask & QFont::SizeResolvedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
721 const qreal pointSize = font.pointSizeF();-
722 if (pointSize > 0
pointSize > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
723 setFontPointSize(pointSize);-
724 }
never executed: end of block
else {
0
725 const int pixelSize = font.pixelSize();-
726 if (pixelSize > 0
pixelSize > 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
727 setProperty(QTextFormat::FontPixelSize, pixelSize);
never executed: setProperty(QTextFormat::FontPixelSize, pixelSize);
0
728 }
never executed: end of block
0
729 }-
730-
731 if (mask & QFont::WeightResolved
mask & QFont::WeightResolvedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
732 setFontWeight(font.weight());
never executed: setFontWeight(font.weight());
0
733 if (mask & QFont::StyleResolved
mask & QFont::StyleResolvedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
734 setFontItalic(font.style() != QFont::StyleNormal);
never executed: setFontItalic(font.style() != QFont::StyleNormal);
0
735 if (mask & QFont::UnderlineResolved
mask & QFont::...erlineResolvedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
736 setUnderlineStyle(font.underline() ? SingleUnderline : NoUnderline);
never executed: setUnderlineStyle(font.underline() ? SingleUnderline : NoUnderline);
0
737 if (mask & QFont::OverlineResolved
mask & QFont::OverlineResolvedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
738 setFontOverline(font.overline());
never executed: setFontOverline(font.overline());
0
739 if (mask & QFont::StrikeOutResolved
mask & QFont::...ikeOutResolvedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
740 setFontStrikeOut(font.strikeOut());
never executed: setFontStrikeOut(font.strikeOut());
0
741 if (mask & QFont::FixedPitchResolved
mask & QFont::...dPitchResolvedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
742 setFontFixedPitch(font.fixedPitch());
never executed: setFontFixedPitch(font.fixedPitch());
0
743 if (mask & QFont::CapitalizationResolved
mask & QFont::...zationResolvedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
744 setFontCapitalization(font.capitalization());
never executed: setFontCapitalization(font.capitalization());
0
745 if (mask & QFont::WordSpacingResolved
mask & QFont::...pacingResolvedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
746 setFontWordSpacing(font.wordSpacing());
never executed: setFontWordSpacing(font.wordSpacing());
0
747 if (mask & QFont::LetterSpacingResolved
mask & QFont::...pacingResolvedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
748 setFontLetterSpacingType(font.letterSpacingType());-
749 setFontLetterSpacing(font.letterSpacing());-
750 }
never executed: end of block
0
751 if (mask & QFont::StretchResolved
mask & QFont::StretchResolvedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
752 setFontStretch(font.stretch());
never executed: setFontStretch(font.stretch());
0
753 if (mask & QFont::StyleHintResolved
mask & QFont::...leHintResolvedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
754 setFontStyleHint(font.styleHint());
never executed: setFontStyleHint(font.styleHint());
0
755 if (mask & QFont::StyleStrategyResolved
mask & QFont::...rategyResolvedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
756 setFontStyleStrategy(font.styleStrategy());
never executed: setFontStyleStrategy(font.styleStrategy());
0
757 if (mask & QFont::HintingPreferenceResolved
mask & QFont::...erenceResolvedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
758 setFontHintingPreference(font.hintingPreference());
never executed: setFontHintingPreference(font.hintingPreference());
0
759 if (mask & QFont::KerningResolved
mask & QFont::KerningResolvedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
760 setFontKerning(font.kerning());
never executed: setFontKerning(font.kerning());
0
761}
never executed: end of block
0
762-
763-
764-
765-
766QFont QTextCharFormat::font() const-
767{-
768 return
never executed: return d ? d->font() : QFont();
d ? d->font() : QFont();
never executed: return d ? d->font() : QFont();
0
769}-
770QTextBlockFormat::QTextBlockFormat() : QTextFormat(BlockFormat) {}
never executed: end of block
0
771QTextBlockFormat::QTextBlockFormat(const QTextFormat &fmt)-
772 : QTextFormat(fmt)-
773{-
774}
never executed: end of block
0
775void QTextBlockFormat::setTabPositions(const QList<QTextOption::Tab> &tabs)-
776{-
777 QList<QVariant> list;-
778 list.reserve(tabs.count());-
779 QList<QTextOption::Tab>::ConstIterator iter = tabs.constBegin();-
780 while (iter != tabs.constEnd()
iter != tabs.constEnd()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
781 QVariant v;-
782 v.setValue<QTextOption::Tab>(*iter);-
783 list.append(v);-
784 ++iter;-
785 }
never executed: end of block
0
786 setProperty(TabPositions, list);-
787}
never executed: end of block
0
788-
789-
790-
791-
792-
793-
794-
795QList<QTextOption::Tab> QTextBlockFormat::tabPositions() const-
796{-
797 QVariant variant = property(TabPositions);-
798 if(variant.isNull()
variant.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
799 return
never executed: return QList<QTextOption::Tab>();
QList<QTextOption::Tab>();
never executed: return QList<QTextOption::Tab>();
0
800 QList<QTextOption::Tab> answer;-
801 QList<QVariant> variantsList = qvariant_cast<QList<QVariant> >(variant);-
802 QList<QVariant>::Iterator iter = variantsList.begin();-
803 answer.reserve(variantsList.count());-
804 while(iter != variantsList.end()
iter != variantsList.end()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
805 answer.append( qvariant_cast<QTextOption::Tab>(*iter));-
806 ++iter;-
807 }
never executed: end of block
0
808 return
never executed: return answer;
answer;
never executed: return answer;
0
809}-
810QTextListFormat::QTextListFormat()-
811 : QTextFormat(ListFormat)-
812{-
813 setIndent(1);-
814}
never executed: end of block
0
815QTextListFormat::QTextListFormat(const QTextFormat &fmt)-
816 : QTextFormat(fmt)-
817{-
818}
never executed: end of block
0
819QTextFrameFormat::QTextFrameFormat() : QTextFormat(FrameFormat)-
820{-
821 setBorderStyle(BorderStyle_Outset);-
822 setBorderBrush(Qt::darkGray);-
823}
never executed: end of block
0
824QTextFrameFormat::QTextFrameFormat(const QTextFormat &fmt)-
825 : QTextFormat(fmt)-
826{-
827}
never executed: end of block
0
828void QTextFrameFormat::setMargin(qreal amargin)-
829{-
830 setProperty(FrameMargin, amargin);-
831 setProperty(FrameTopMargin, amargin);-
832 setProperty(FrameBottomMargin, amargin);-
833 setProperty(FrameLeftMargin, amargin);-
834 setProperty(FrameRightMargin, amargin);-
835}
never executed: end of block
0
836qreal QTextFrameFormat::topMargin() const-
837{-
838 if (!hasProperty(FrameTopMargin)
!hasProperty(FrameTopMargin)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
839 return
never executed: return margin();
margin();
never executed: return margin();
0
840 return
never executed: return doubleProperty(FrameTopMargin);
doubleProperty(FrameTopMargin);
never executed: return doubleProperty(FrameTopMargin);
0
841}-
842qreal QTextFrameFormat::bottomMargin() const-
843{-
844 if (!hasProperty(FrameBottomMargin)
!hasProperty(F...eBottomMargin)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
845 return
never executed: return margin();
margin();
never executed: return margin();
0
846 return
never executed: return doubleProperty(FrameBottomMargin);
doubleProperty(FrameBottomMargin);
never executed: return doubleProperty(FrameBottomMargin);
0
847}-
848qreal QTextFrameFormat::leftMargin() const-
849{-
850 if (!hasProperty(FrameLeftMargin)
!hasProperty(FrameLeftMargin)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
851 return
never executed: return margin();
margin();
never executed: return margin();
0
852 return
never executed: return doubleProperty(FrameLeftMargin);
doubleProperty(FrameLeftMargin);
never executed: return doubleProperty(FrameLeftMargin);
0
853}-
854qreal QTextFrameFormat::rightMargin() const-
855{-
856 if (!hasProperty(FrameRightMargin)
!hasProperty(FrameRightMargin)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
857 return
never executed: return margin();
margin();
never executed: return margin();
0
858 return
never executed: return doubleProperty(FrameRightMargin);
doubleProperty(FrameRightMargin);
never executed: return doubleProperty(FrameRightMargin);
0
859}-
860QTextTableFormat::QTextTableFormat()-
861 : QTextFrameFormat()-
862{-
863 setObjectType(TableObject);-
864 setCellSpacing(2);-
865 setBorder(1);-
866}
never executed: end of block
0
867QTextTableFormat::QTextTableFormat(const QTextFormat &fmt)-
868 : QTextFrameFormat(fmt)-
869{-
870}
never executed: end of block
0
871QTextImageFormat::QTextImageFormat() : QTextCharFormat() { setObjectType(ImageObject); }
never executed: end of block
0
872QTextImageFormat::QTextImageFormat(const QTextFormat &fmt)-
873 : QTextCharFormat(fmt)-
874{-
875}
never executed: end of block
0
876QTextTableCellFormat::QTextTableCellFormat()-
877 : QTextCharFormat()-
878{-
879 setObjectType(TableCellObject);-
880}
never executed: end of block
0
881QTextTableCellFormat::QTextTableCellFormat(const QTextFormat &fmt)-
882 : QTextCharFormat(fmt)-
883{-
884}
never executed: end of block
0
885QTextFormatCollection::QTextFormatCollection(const QTextFormatCollection &rhs)-
886{-
887 formats = rhs.formats;-
888 objFormats = rhs.objFormats;-
889}
never executed: end of block
0
890-
891QTextFormatCollection &QTextFormatCollection::operator=(const QTextFormatCollection &rhs)-
892{-
893 formats = rhs.formats;-
894 objFormats = rhs.objFormats;-
895 return
never executed: return *this;
*this;
never executed: return *this;
0
896}-
897-
898QTextFormatCollection::~QTextFormatCollection()-
899{-
900}-
901-
902int QTextFormatCollection::indexForFormat(const QTextFormat &format)-
903{-
904 uint hash = getHash(format.d, format.format_type);-
905 QMultiHash<uint, int>::const_iterator i = hashes.constFind(hash);-
906 while (i != hashes.constEnd()
i != hashes.constEnd()Description
TRUEnever evaluated
FALSEnever evaluated
&& i.key() == hash
i.key() == hashDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
907 if (formats.value(i.value()) == format
formats.value(...e()) == formatDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
908 return
never executed: return i.value();
i.value();
never executed: return i.value();
0
909 }-
910 ++i;-
911 }
never executed: end of block
0
912-
913 int idx = formats.size();-
914 formats.append(format);-
915-
916 if (true){-
917 QTextFormat &f = formats.last();-
918 if (!f.d
!f.dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
919 f.d = new QTextFormatPrivate;
never executed: f.d = new QTextFormatPrivate;
0
920 f.d->resolveFont(defaultFnt);-
921-
922 if (!hashes.contains(hash, idx)
!hashes.contains(hash, idx)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
923 hashes.insert(hash, idx);
never executed: hashes.insert(hash, idx);
0
924-
925 }
never executed: end of block
else {
dead code: { formats.pop_back(); qt_noop(); }
-
926 formats.pop_back();
dead code: { formats.pop_back(); qt_noop(); }
-
927 qt_noop();
dead code: { formats.pop_back(); qt_noop(); }
-
928 }
dead code: { formats.pop_back(); qt_noop(); }
-
929 return
never executed: return idx;
idx;
never executed: return idx;
0
930}-
931-
932bool QTextFormatCollection::hasFormatCached(const QTextFormat &format) const-
933{-
934 uint hash = getHash(format.d, format.format_type);-
935 QMultiHash<uint, int>::const_iterator i = hashes.constFind(hash);-
936 while (i != hashes.constEnd()
i != hashes.constEnd()Description
TRUEnever evaluated
FALSEnever evaluated
&& i.key() == hash
i.key() == hashDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
937 if (formats.value(i.value()) == format
formats.value(...e()) == formatDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
938 return
never executed: return true;
true;
never executed: return true;
0
939 }-
940 ++i;-
941 }
never executed: end of block
0
942 return
never executed: return false;
false;
never executed: return false;
0
943}-
944-
945int QTextFormatCollection::objectFormatIndex(int objectIndex) const-
946{-
947 if (objectIndex == -1
objectIndex == -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
948 return
never executed: return -1;
-1;
never executed: return -1;
0
949 return
never executed: return objFormats.at(objectIndex);
objFormats.at(objectIndex);
never executed: return objFormats.at(objectIndex);
0
950}-
951-
952void QTextFormatCollection::setObjectFormatIndex(int objectIndex, int formatIndex)-
953{-
954 objFormats[objectIndex] = formatIndex;-
955}
never executed: end of block
0
956-
957int QTextFormatCollection::createObjectIndex(const QTextFormat &f)-
958{-
959 const int objectIndex = objFormats.size();-
960 objFormats.append(indexForFormat(f));-
961 return
never executed: return objectIndex;
objectIndex;
never executed: return objectIndex;
0
962}-
963-
964QTextFormat QTextFormatCollection::format(int idx) const-
965{-
966 if (idx < 0
idx < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| idx >= formats.count()
idx >= formats.count()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
967 return
never executed: return QTextFormat();
QTextFormat();
never executed: return QTextFormat();
0
968-
969 return
never executed: return formats.at(idx);
formats.at(idx);
never executed: return formats.at(idx);
0
970}-
971-
972void QTextFormatCollection::setDefaultFont(const QFont &f)-
973{-
974 defaultFnt = f;-
975 for (int i = 0; i < formats.count()
i < formats.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
976 if (formats.at(i).d
formats.at(i).dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
977 formats[i].d->resolveFont(defaultFnt);
never executed: formats[i].d->resolveFont(defaultFnt);
0
978}
never executed: end of block
0
979-
980-
981QDebug operator<<(QDebug dbg, const QTextLength &l)-
982{-
983 QDebugStateSaver saver(dbg);-
984 dbg.nospace() << "QTextLength(QTextLength::Type(" << l.type() << "))";-
985 return
never executed: return dbg;
dbg;
never executed: return dbg;
0
986}-
987-
988QDebug operator<<(QDebug dbg, const QTextFormat &f)-
989{-
990 QDebugStateSaver saver(dbg);-
991 dbg.nospace() << "QTextFormat(QTextFormat::FormatType(" << f.type() << "))";-
992 return
never executed: return dbg;
dbg;
never executed: return dbg;
0
993}-
994-
995-
996-
997-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9