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