150 #ifndef QT_NO_DATASTREAM
159 double fixedValueOrPercentage;
161 length.fixedValueOrPercentage = fixedValueOrPercentage;
207 for (
int i = 0;
i <
props.count(); ++
i)
217 for (
int i = 0;
i <
props.count(); ++
i)
229 for (
int i = 0;
i <
props.count(); ++
i)
257 size_t recalcHash()
const;
258 void recalcFont()
const;
260 mutable bool hashDirty;
261 mutable bool fontDirty;
262 mutable size_t hashValue;
271 return (
color.isValid()) ?
color.rgba() : 0x234109;
274 static inline size_t hash(
const QPen &pen)
291 case QMetaType::QBrush:
292 return 0x01010101 +
hash(qvariant_cast<QBrush>(
variant));
294 case QMetaType::QPen:
return 0x02020202 +
hash(qvariant_cast<QPen>(
variant));
296 return 0x8377U + qvariant_cast<QVariantList>(
variant).
count();
297 case QMetaType::QColor:
return hash(qvariant_cast<QColor>(
variant));
298 case QMetaType::QTextLength:
299 return 0x377 +
hash(qvariant_cast<QTextLength>(
variant).rawValue());
309 return (
d ?
d->hash() : 0) +
format;
312 size_t QTextFormatPrivate::recalcHash()
const
317 hashValue += (
static_cast<quint32>(
it->key) << 16) + variantHash(
it->value);
328 fnt = fnt.
resolve(defaultFont);
337 qreal pixelSize = scaleFactors[htmlFontSize] * defaultFont.
pixelSize();
340 qreal pointSize = scaleFactors[htmlFontSize] * defaultFont.
pointSizeF();
348 void QTextFormatPrivate::recalcFont()
const
353 bool hasSpacingInformation =
false;
355 qreal letterSpacing = 0.0;
357 for (
int i = 0;
i <
props.count(); ++
i) {
358 switch (
props.at(
i).key) {
360 f.setFamilies(
props.at(
i).value.toStringList());
363 f.setStyleName(
props.at(
i).value.toString());
366 f.setPointSizeF(
props.at(
i).value.toReal());
369 f.setPixelSize(
props.at(
i).value.toInt());
378 f.setItalic(
props.at(
i).value.toBool());
382 f.setUnderline(
props.at(
i).value.toBool());
388 f.setOverline(
props.at(
i).value.toBool());
391 f.setStrikeOut(
props.at(
i).value.toBool());
395 hasSpacingInformation =
true;
398 letterSpacing =
props.at(
i).value.toReal();
399 hasSpacingInformation =
true;
402 f.setWordSpacing(
props.at(
i).value.toReal());
409 if (
f.fixedPitch() !=
value)
413 f.setStretch(
props.at(
i).value.toInt());
425 f.setKerning(
props.at(
i).value.toBool());
432 if (hasSpacingInformation)
433 f.setLetterSpacing(spacingType, letterSpacing);
439 #ifndef QT_NO_DATASTREAM
445 if (
it != properties.end()) {
447 properties.erase(
it);
451 if (
it != properties.end()) {
453 properties.erase(
it);
457 if (
it != properties.end()) {
459 properties.erase(
it);
463 if (
it != properties.end()) {
465 properties.erase(
it);
469 stream << fmt.format_type << properties;
476 stream >> fmt.format_type >> properties;
484 it != properties.constEnd(); ++
it) {
905 : format_type(InvalidFormat)
927 :
d(
rhs.
d), format_type(
rhs.format_type)
940 format_type =
rhs.format_type;
974 if (format_type !=
other.format_type)
988 p->props.reserve(
p->props.size() + otherProps.
size());
989 for (
int i = 0;
i < otherProps.
count(); ++
i) {
991 p->insertProperty(prop.key, prop.value);
1074 const QVariant prop =
d->property(propertyId);
1094 const QVariant prop =
d->property(propertyId);
1097 return prop.
toInt();
1112 const QVariant prop =
d->property(propertyId);
1115 return qvariant_cast<qreal>(prop);
1130 const QVariant prop =
d->property(propertyId);
1148 const QVariant prop =
d->property(propertyId);
1149 if (prop.
userType() != QMetaType::QColor)
1151 return qvariant_cast<QColor>(prop);
1166 const QVariant prop =
d->property(propertyId);
1167 if (prop.
userType() != QMetaType::QPen)
1169 return qvariant_cast<QPen>(prop);
1184 const QVariant prop =
d->property(propertyId);
1185 if (prop.
userType() != QMetaType::QBrush)
1187 return qvariant_cast<QBrush>(prop);
1200 return qvariant_cast<QTextLength>(
d->property(propertyId));
1216 const QVariant prop =
d->property(propertyId);
1221 for (
const auto &
var : propertyList) {
1223 list.append(qvariant_cast<QTextLength>(
var));
1236 return d ?
d->property(propertyId) :
QVariant();
1248 if (!
value.isValid())
1251 d->insertProperty(propertyId,
value);
1264 const int numValues =
value.size();
1265 list.reserve(numValues);
1266 for (
int i = 0;
i < numValues; ++
i)
1268 d->insertProperty(propertyId,
list);
1280 d->clearProperty(propertyId);
1314 return prop.
toInt();
1345 return d ?
d->hasProperty(propertyId) :
false;
1361 for (
int i = 0;
i <
d->props.count(); ++
i)
1373 return d ?
d->props.count() : 0;
1392 if (format_type !=
rhs.format_type)
1398 if (
d &&
d->props.isEmpty() && !
rhs.d)
1401 if (!
d &&
rhs.d &&
rhs.d->props.isEmpty())
1407 return *
d == *
rhs.d;
1536 #if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
1569 #if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
2139 if (pointSize > 0) {
2185 return d ?
d->font() :
QFont();
2301 while(
iter != variantsList.
end()) {
2302 answer.
append( qvariant_cast<QTextOption::Tab>(*
iter));
4007 if (objectIndex == -1)
4037 formats[
i].d->resolveFont(defaultFnt);
4040 #ifndef QT_NO_DEBUG_STREAM
4044 dbg.
nospace() <<
"QTextLength(QTextLength::Type(" <<
l.type() <<
"))";
4051 dbg.
nospace() <<
"QTextFormat(QTextFormat::FormatType(" <<
f.type() <<
"))";
4059 #include "moc_qtextformat.cpp"
small capitals from c petite p scientific i
[1]
The QBrush class defines the fill pattern of shapes drawn by QPainter.
The QColor class provides colors based on RGB, HSV or CMYK values.
The QDataStream class provides serialization of binary data to a QIODevice.
operator>>(QDataStream &ds, qfloat16 &f)
operator<<(QDataStream &ds, qfloat16 f)
The QDebug class provides an output stream for debugging information.
Convenience class for custom QDebug operators.
template< typename Enum > size_t qHash(QFlags< Enum > flags, size_t seed=0) noexcept
The QFont class specifies a query for a font used for drawing text.
StyleStrategy styleStrategy() const
QString styleName() const
StyleHint styleHint() const
qreal letterSpacing() const
QFont resolve(const QFont &) const
HintingPreference hintingPreference() const
Capitalization capitalization() const
QStringList families() const
@ HintingPreferenceResolved
qreal wordSpacing() const
void setResolveMask(uint mask)
SpacingType letterSpacingType() const
void setPointSizeF(qreal)
qsizetype size() const noexcept
const_reference at(qsizetype i) const noexcept
T value(qsizetype i) const
const_iterator constBegin() const noexcept
qsizetype count() const noexcept
void reserve(qsizetype size)
void append(parameter_type t)
const_iterator constEnd() const noexcept
iterator insert(const Key &key, const T &value)
const_iterator constEnd() const noexcept
iterator insert(const Key &key, const T &value)
void clear() noexcept(std::is_nothrow_destructible< Node >::value)
const_iterator constFind(const Key &key) const noexcept
The QPen class defines how a QPainter should draw lines and outlines of shapes.
The QSharedData class is a base class for shared data objects. \reentrant.
The QString class provides a Unicode character string.
The QStringList class provides a list of strings.
The QTextBlockFormat class provides formatting information for blocks of text in a QTextDocument....
QList< QTextOption::Tab > tabPositions() const
void setTabPositions(const QList< QTextOption::Tab > &tabs)
The QTextCharFormat class provides formatting information for characters in a QTextDocument....
FontPropertiesInheritanceBehavior
QStringList anchorNames() const
void setFontFamilies(const QStringList &families)
void setUnderlineStyle(UnderlineStyle style)
UnderlineStyle underlineStyle() const
void setFontWordSpacing(qreal spacing)
void setFontPointSize(qreal size)
void setFontKerning(bool enable)
void setFontStyleHint(QFont::StyleHint hint, QFont::StyleStrategy strategy=QFont::PreferDefault)
void setFontFixedPitch(bool fixedPitch)
void setFontLetterSpacing(qreal spacing)
void setFontStyleStrategy(QFont::StyleStrategy strategy)
void setFontStrikeOut(bool strikeOut)
void setFontHintingPreference(QFont::HintingPreference hintingPreference)
void setFontStretch(int factor)
bool fontUnderline() const
void setFontOverline(bool overline)
void setFontLetterSpacingType(QFont::SpacingType letterSpacingType)
void setFontStyleName(const QString &styleName)
void setFontItalic(bool italic)
void setFontWeight(int weight)
void setFontCapitalization(QFont::Capitalization capitalization)
void setFont(const QFont &font, FontPropertiesInheritanceBehavior behavior=FontPropertiesAll)
int indexForFormat(const QTextFormat &f)
QMultiHash< size_t, int > hashes
QList< qint32 > objFormats
int createObjectIndex(const QTextFormat &f)
int objectFormatIndex(int objectIndex) const
void setObjectFormatIndex(int objectIndex, int formatIndex)
QTextFormat format(int idx) const
bool hasFormatCached(const QTextFormat &format) const
void setDefaultFont(const QFont &f)
The QTextFormat class provides formatting information for a QTextDocument. \inmodule QtGui.
QTextCharFormat toCharFormat() const
QString stringProperty(int propertyId) const
QTextBlockFormat toBlockFormat() const
@ OldFontLetterSpacingType
QTextLength lengthProperty(int propertyId) const
int intProperty(int propertyId) const
QColor colorProperty(int propertyId) const
bool boolProperty(int propertyId) const
QTextFormat & operator=(const QTextFormat &rhs)
void setProperty(int propertyId, const QVariant &value)
friend class QTextCharFormat
QBrush brushProperty(int propertyId) const
QTextTableFormat toTableFormat() const
QTextImageFormat toImageFormat() const
void setObjectType(int type)
QMap< int, QVariant > properties() const
QTextTableCellFormat toTableCellFormat() const
int propertyCount() const
QTextListFormat toListFormat() const
bool hasProperty(int propertyId) const
QPen penProperty(int propertyId) const
void setObjectIndex(int object)
bool operator==(const QTextFormat &rhs) const
QTextFrameFormat toFrameFormat() const
void clearProperty(int propertyId)
void merge(const QTextFormat &other)
QList< QTextLength > lengthVectorProperty(int propertyId) const
qreal doubleProperty(int propertyId) const
QVariant property(int propertyId) const
friend QDataStream & operator>>(QDataStream &, QTextFormat &)
friend QDataStream & operator<<(QDataStream &, const QTextFormat &)
bool hasProperty(qint32 key) const
bool operator==(const QTextFormatPrivate &rhs) const
void resolveFont(const QFont &defaultFont)
void insertProperty(qint32 key, const QVariant &value)
QVariant property(qint32 key) const
int propertyIndex(qint32 key) const
void clearProperty(qint32 key)
const QFont & font() const
The QTextFrameFormat class provides formatting information for frames in a QTextDocument....
void setBorderBrush(const QBrush &brush)
void setBorderStyle(BorderStyle style)
void setBorder(qreal border)
qreal bottomMargin() const
qreal rightMargin() const
void setMargin(qreal margin)
The QTextImageFormat class provides formatting information for images in a QTextDocument....
The QTextLength class encapsulates the different types of length used in a QTextDocument....
The QTextListFormat class provides formatting information for lists in a QTextDocument....
void setIndent(int indent)
The QTextTableCellFormat class provides formatting information for table cells in a QTextDocument....
The QTextTableFormat class provides formatting information for tables in a QTextDocument....
void setCellSpacing(qreal spacing)
The QVariant class acts like a union for the most common Qt data types.
static auto fromValue(const T &value) -> std::enable_if_t< std::is_copy_constructible_v< T >, QVariant >
double toDouble(bool *ok=nullptr) const
QList< QVariant > toList() const
int toInt(bool *ok=nullptr) const
float toFloat(bool *ok=nullptr) const
const char * typeName() const
QStringList toStringList() const
QHash< int, QWidget * > hash
[35multi]
QMap< QString, QString > map
[6]
QList< QString > QStringList
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter * iter
EGLOutputLayerEXT EGLint EGLAttrib value
int qRound(qfloat16 d) noexcept
QT_END_INCLUDE_NAMESPACE typedef double qreal
QList< QVariant > QVariantList
bool operator==(const QMakeBaseKey &one, const QMakeBaseKey &two)
GLenum GLuint GLenum GLsizei length
GLsizei const GLfloat * v
[13]
GLuint GLuint GLfloat weight
GLenum GLuint GLsizei const GLenum * props
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLint GLsizei GLsizei GLenum format
int QT_PREPEND_NAMESPACE(QSharedMemoryPrivate)
Q_DECLARE_TYPEINFO(Property, Q_RELOCATABLE_TYPE)