178 #ifndef QT_NO_DATASTREAM 187 double fixedValueOrPercentage;
188 stream >> type >> fixedValueOrPercentage;
193 #endif // QT_NO_DATASTREAM 209 {
return key == other.
key && value == other.
value; }
211 {
return key != other.
key || value != other.
value; }
233 for (
int i = 0; i <
props.count(); ++i)
243 for (
int i = 0; i <
props.count(); ++i)
255 for (
int i = 0; i <
props.count(); ++i)
266 return props.at(idx).value;
301 union {
float f;
uint u; } cvt;
305 return reinterpret_cast<uint&
>(
d);
311 return (color.
isValid()) ? color.
rgba() : 0x234109;
332 return 0x01010101 +
hash(qvariant_cast<QBrush>(variant));
339 return 0x377 +
hash(qvariant_cast<QTextLength>(variant).rawValue());
349 return (d ? d->
hash() : 0) + format;
392 for (
int i = 0; i <
props.count(); ++i) {
393 switch (
props.at(i).key) {
404 int weight =
props.at(i).value.toInt();
434 const bool value =
props.at(i).value.toBool();
458 #ifndef QT_NO_DATASTREAM 481 #endif // QT_NO_DATASTREAM 815 : format_type(InvalidFormat)
897 for (
int i = 0; i < otherProps.
count(); ++i) {
1006 return prop.
toInt();
1124 for (
int i=0; i<propertyList.
size(); ++i) {
1127 vector.
append(qvariant_cast<QTextLength>(var));
1168 for (
int i=0; i<value.
size(); ++i)
1169 list << value.
at(i);
1222 return prop.
toInt();
1272 for (
int i = 0; i <
d->
props.count(); ++i)
1287 return d ?
d->
props.count() : 0;
1318 if (
d &&
d->
props.isEmpty() && !rhs.
d)
1321 if (!
d && rhs.
d && rhs.
d->
props.isEmpty())
1327 return *
d == *rhs.
d;
2098 if (pointSize > 0) {
2256 while(iter != variantsList.
end()) {
2257 answer.
append( qvariant_cast<QTextOption::Tab>(*iter));
3873 while (i != hashes.
end() && i.
key() ==
hash) {
3874 if (formats.value(i.
value()) == format) {
3880 int idx = formats.
size();
3881 formats.append(format);
3889 if (!hashes.contains(hash, idx))
3890 hashes.insert(hash, idx);
3903 while (i != hashes.
end() && i.
key() ==
hash) {
3904 if (formats.value(i.
value()) == format) {
3914 if (objectIndex == -1)
3916 return format(objFormats.at(objectIndex));
3921 const int formatIndex = indexForFormat(f);
3927 if (objectIndex == -1)
3929 return objFormats.at(objectIndex);
3940 objFormats.append(indexForFormat(f));
3946 if (idx < 0 || idx >= formats.count())
3949 return formats.at(idx);
3955 for (
int i = 0; i < formats.count(); ++i)
3957 formats[i].
d->resolveFont(defaultFnt);
The QVariant class acts like a union for the most common Qt data types.
int objectIndex() const
Returns the index of the format object, or -1 if the format object is invalid.
The QMultiHash class is a convenience QHash subclass that provides multi-valued hashes.
void setWordSpacing(qreal spacing)
Sets the word spacing for the font to spacing.
The QColor class provides colors based on RGB, HSV or CMYK values.
void setFontKerning(bool enable)
Enables kerning for this font if enable is true; otherwise disables it.
QTextTableFormat()
Constructs a new table format object.
QStringList anchorNames() const
Returns the anchor names associated with this text format, or an empty string list if none has been s...
QFont font() const
Returns the font for this character format.
uint qHash(const QProcEnvKey &key)
QTextFormat()
Creates a new text format with an InvalidFormat.
void setCapitalization(Capitalization)
Sets the capitalization of the text in this font to caps.
int objectFormatIndex(int objectIndex) const
void setBorderBrush(const QBrush &brush)
Sets the brush used for the frame's border.
friend QDataStream & operator<<(QDataStream &, const QTextFormat &)
void setFontItalic(bool italic)
If italic is true, sets the text format's font to be italic; otherwise the font will be non-italic...
The QTextCharFormat class provides formatting information for characters in a QTextDocument.
The QTextListFormat class provides formatting information for lists in a QTextDocument.
#define QT_END_NAMESPACE
This macro expands to.
const QColor & color() const
Returns the brush color.
void setKerning(bool)
Enables kerning for this font if enable is true; otherwise disables it.
static int getHash(const QTextFormatPrivate *d, int format)
Property(qint32 k, const QVariant &v)
void setBorder(qreal border)
Sets the width (in pixels) of the frame's border.
void setFontStrikeOut(bool strikeOut)
If strikeOut is true, sets the text format's font with strike-out enabled (with a horizontal line thr...
void clearProperty(qint32 key)
bool isNull() const
Returns true if this is a NULL variant, false otherwise.
#define it(className, varName)
QColor colorProperty(int propertyId) const
Returns the value of the property given by propertyId; if the property isn't of QVariant::Color type...
int count(const T &t) const
Returns the number of occurrences of value in the vector.
void setBorderStyle(BorderStyle style)
Sets the style of the frame's border.
bool underline() const
Returns true if underline has been set; otherwise returns false.
void setProperty(int propertyId, const QVariant &value)
Sets the property specified by the propertyId to the given value.
void setUnderline(bool)
If enable is true, sets underline on; otherwise sets underline off.
QTextTableCellFormat toTableCellFormat() const
Returns this format as a table cell format.
int pixelSize() const
Returns the pixel size of the font if it was set with setPixelSize().
QBrush brushProperty(int propertyId) const
Returns the value of the property given by propertyId; if the property isn't of QVariant::Brush type...
QTextBlockFormat()
Constructs a new QTextBlockFormat.
void setIndent(int indent)
Sets the list format's indentation.
const QFont & font() const
void setFontOverline(bool overline)
If overline is true, sets the text format's font to be overlined; otherwise the font is displayed non...
friend class QTextCharFormat
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
bool operator==(const QTextFormatPrivate &rhs) const
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
void setFont(const QFont &font)
Sets the text format's font.
void setFontStyleStrategy(QFont::StyleStrategy strategy)
Sets the font style strategy.
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the list.
Capitalization capitalization() const
Returns the current capitalization type of the font.
QColor color() const
Returns the color of this pen's brush.
int createObjectIndex(const QTextFormat &f)
QTextFormatCollection & operator=(const QTextFormatCollection &rhs)
QMap< int, QVariant > properties() const
Returns a map with all properties of this text format.
QList< QVariant > toList() const
Returns the variant as a QVariantList if the variant has type() List or StringList ; otherwise return...
bool toBool() const
Returns the variant as a bool if the variant has type() Bool.
QString anchorName() const
This function is deprecated.
void setFontFixedPitch(bool fixedPitch)
If fixedPitch is true, sets the text format's font to be fixed pitch; otherwise a non-fixed pitch fon...
Type
This enum describes the different types a length object can have.
QTextCharFormat()
Constructs a new character format object.
QVector< QTextLength > lengthVectorProperty(int propertyId) const
Returns the value of the property given by propertyId.
qreal leftMargin() const
Returns the width of the frame's left margin in pixels.
QTextTableFormat toTableFormat() const
Returns this format as a table format.
The QString class provides a Unicode character string.
void setItalic(bool b)
Sets the style() of the font to QFont::StyleItalic if enable is true; otherwise the style is set to Q...
QTextFormat format(int idx) const
QTextFormat objectFormat(int objectIndex) const
void setValue(const T &value)
Stores a copy of value.
void setTabPositions(const QList< QTextOption::Tab > &tabs)
Sets the tab positions for the text block to those specified by tabs.
The QVector class is a template class that provides a dynamic array.
QVariant property(qint32 key) const
The QPen class defines how a QPainter should draw lines and outlines of shapes.
bool kerning() const
Returns true if kerning should be used when drawing text with this font.
QHash< Key, T >::iterator find(const Key &key, const T &value)
Returns an iterator pointing to the item with the key and value.
void setHintingPreference(HintingPreference hintingPreference)
Set the preference for the hinting level of the glyphs to hintingPreference.
const T value(const Key &key) const
Returns the value associated with the key.
void setStyleStrategy(StyleStrategy s)
Sets the style strategy for the font to s.
QTextListFormat()
Constructs a new list format object.
bool hasProperty(qint32 key) const
void setFontWeight(int weight)
Sets the text format's font weight to weight.
int toInt(bool *ok=0) const
Returns the variant as an int if the variant has type() Int , Bool , ByteArray , Char ...
QTextFrameFormat toFrameFormat() const
Returns this format as a frame format.
void setFamily(const QString &)
Sets the family name of the font.
bool operator==(const Property &other) const
bool hasProperty(int propertyId) const
Returns true if the text format has a property with the given propertyId; otherwise returns false...
int type() const
Returns the type of this format.
QFont resolve(const QFont &) const
Returns a new QFont that has attributes copied from other that have not been previously set on this f...
QStringList toStringList() const
Returns the variant as a QStringList if the variant has type() StringList, String ...
void append(const T &t)
Inserts value at the end of the list.
QTextFrameFormat()
Constructs a text frame format object with the default properties.
The QTextImageFormat class provides formatting information for images in a QTextDocument.
QFuture< void > map(Sequence &sequence, MapFunction function)
#define QT_BEGIN_NAMESPACE
This macro expands to.
qreal pointSizeF() const
Returns the point size of the font.
UnderlineStyle underlineStyle() const
Returns the style of underlining the text.
qreal topMargin() const
Returns the width of the frame's top margin in pixels.
UnderlineStyle
This enum describes the different ways drawing underlined text.
friend QDataStream & operator>>(QDataStream &, QTextFormat &)
qreal margin() const
Returns the width of the frame's external margin in pixels.
void resolveFont(const QFont &defaultFont)
qreal bottomMargin() const
Returns the width of the frame's bottom margin in pixels.
static float pixelSize(const QFontDef &request, int dpi)
bool overline() const
Returns true if overline has been set; otherwise returns false.
static uint hash(float d)
void setFontCapitalization(QFont::Capitalization capitalization)
Sets the capitalization of the text that apppears in this font to capitalization. ...
The QTextFormat class provides formatting information for a QTextDocument.
void setStrikeOut(bool)
If enable is true, sets strikeout on; otherwise sets strikeout off.
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
void setDefaultFont(const QFont &f)
const T & at(int i) const
Returns the item at index position i in the list.
QList< QTextOption::Tab > tabPositions() const
Returns a list of tab positions defined for the text block.
The QStringList class provides a list of strings.
void setFontLetterSpacing(qreal spacing)
Sets the letter spacing of this format to the given spacing, in percent.
static int toInt(const QByteArray &str)
void append(const T &t)
Inserts value at the end of the vector.
SpacingType letterSpacingType() const
Returns the spacing type used for letter spacing.
QTextBlockFormat toBlockFormat() const
Returns this format as a block format.
void setFontPointSize(qreal size)
Sets the text format's font size.
QTextListFormat toListFormat() const
Returns this format as a list format.
T value(int i) const
Returns the value at index position i in the list.
Qt::BrushStyle style() const
Returns the brush style.
void setStyleHint(StyleHint, StyleStrategy=PreferDefault)
Sets the style hint and strategy to hint and strategy, respectively.
void setObjectFormat(int objectIndex, const QTextFormat &format)
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the map.
const char * typeName() const
Returns the name of the type stored in the variant.
qreal wordSpacing() const
Returns the word spacing for the font.
void setObjectType(int type)
Sets the text format's object type to type.
const T & at(int i) const
Returns the item at index position i in the vector.
int propertyIndex(qint32 key) const
QTextTableCellFormat()
Constructs a new table cell format object.
void setObjectFormatIndex(int objectIndex, int formatIndex)
The QBrush class defines the fill pattern of shapes drawn by QPainter.
The QMap::const_iterator class provides an STL-style const iterator for QMap and QMultiMap.
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the map...
QTextImageFormat toImageFormat() const
Returns this format as an image format.
int userType() const
Returns the storage type of the value stored in the variant.
void setCellSpacing(qreal spacing)
Sets the cell spacing for the table.
qreal fixedValueOrPercentage
int size() const
Returns the number of items in the hash.
bool fixedPitch() const
Returns true if fixed pitch has been set; otherwise returns false.
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
The QSharedData class is a base class for shared data objects.
void merge(const QTextFormat &other)
Merges the other format with this format; where there are conflicts the other format takes precedence...
The QFont class specifies a font used for drawing text.
~QTextFormat()
Destroys this text format.
QSharedDataPointer< QTextFormatPrivate > d
QString family() const
Returns the requested font family name, i.e.
void setOverline(bool)
If enable is true, sets overline on; otherwise sets overline off.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key key and a value of value.
const Key key(const T &value) const
Returns the first key mapped to value.
void setFixedPitch(bool)
If enable is true, sets fixed pitch on; otherwise sets fixed pitch off.
QVariant property(int propertyId) const
Returns the property specified by the given propertyId.
QExplicitlySharedDataPointer< QFontPrivate > d
Q_DECL_CONSTEXPR const T & qBound(const T &min, const T &val, const T &max)
qreal rightMargin() const
Returns the width of the frame's right margin in pixels.
The QTextFrameFormat class provides formatting information for frames in a QTextDocument.
int size() const
Returns the number of items in the list.
The QTextLength class encapsulates the different types of length used in a QTextDocument.
The QTextBlockFormat class provides formatting information for blocks of text in a QTextDocument...
float toFloat(bool *ok=0) const
Returns the variant as a float if the variant has type() Double , QMetaType::Float ...
void setFontFamily(const QString &family)
Sets the text format's font family.
bool boolProperty(int propertyId) const
Returns the value of the property specified by propertyId.
void setWeight(int)
Sets the weight the font to weight, which should be a value from the QFont::Weight enumeration...
qreal widthF() const
Returns the pen width with floating point precision.
int weight() const
Returns the weight of the font which is one of the enumerated values from QFont::Weight.
QVector< Property > props
void setFontStyleHint(QFont::StyleHint hint, QFont::StyleStrategy strategy=QFont::PreferDefault)
Sets the font style hint and strategy.
T qvariant_cast(const QVariant &)
double toDouble(bool *ok=0) const
Returns the variant as a double if the variant has type() Double , QMetaType::Float ...
static const QCssKnownValue properties[NumProperties - 1]
void insertProperty(qint32 key, const QVariant &value)
void setFontWordSpacing(qreal spacing)
Sets the word spacing of this format to the given spacing, in pixels.
The QTextTableCellFormat class provides formatting information for table cells in a QTextDocument...
QString stringProperty(int propertyId) const
Returns the value of the property given by propertyId; if the property isn't of QVariant::String type...
void setPointSizeF(qreal)
Sets the point size to pointSize.
QVector< qint32 > objFormats
The QTextTableFormat class provides formatting information for tables in a QTextDocument.
void setMargin(qreal margin)
Sets the frame's margin in pixels.
static uint variantHash(const QVariant &variant)
QTextCharFormat toCharFormat() const
Returns this format as a character format.
bool italic() const
Returns true if the style() of the font is not QFont::StyleNormal.
int pointSize() const
Returns the point size of the font.
const_iterator ConstIterator
Qt-style synonym for QVector::const_iterator.
bool operator!=(const Property &other) const
The QDataStream class provides serialization of binary data to a QIODevice.
void clearProperty(int propertyId)
Clears the value of the property given by propertyId.
bool isValid() const
Returns true if the color is valid; otherwise returns false.
QRgb rgba() const
Returns the RGB value of the color, including its alpha.
void setLetterSpacing(SpacingType type, qreal spacing)
Sets the letter spacing for the font to spacing and the type of spacing to type.
int intProperty(int propertyId) const
Returns the value of the property specified by propertyId.
StyleStrategy styleStrategy() const
Returns the StyleStrategy.
void setPixelSize(int)
Sets the font size to pixelSize pixels.
void setObjectIndex(int object)
Sets the format object's object index.
bool strikeOut() const
Returns true if strikeout has been set; otherwise returns false.
bool isValid() const
Returns true if the storage type of this variant is not QVariant::Invalid; otherwise returns false...
QTextImageFormat()
Creates a new image format object.
StyleHint styleHint() const
Returns the StyleHint.
QPen penProperty(int propertyId) const
Returns the value of the property given by propertyId; if the property isn't of QVariant::Pen type...
void setUnderlineStyle(UnderlineStyle style)
Sets the style of underlining the text to style.
bool hasFormatCached(const QTextFormat &format) const
int indexForFormat(const QTextFormat &f)
int propertyCount() const
Returns the number of properties stored in the format.
qreal doubleProperty(int propertyId) const
Returns the value of the property specified by propertyId.
QDataStream & operator<<(QDataStream &out, const QUrl &url)
Writes url url to the stream out and returns a reference to the stream.
int size() const
Returns the number of items in the vector.
static float pointSize(const QFontDef &fd, int dpi)
Q_DECL_CONSTEXPR int qRound(qreal d)
QTextFormat & operator=(const QTextFormat &rhs)
Assigns the other text format to this text format, and returns a reference to this text format...
bool fontUnderline() const
Returns true if the text format's font is underlined; otherwise returns false.
The QMap class is a template class that provides a skip-list-based dictionary.
bool operator==(const QTextFormat &rhs) const
Returns true if this text format is the same as the other text format.
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
qreal letterSpacing() const
Returns the letter spacing for the font.
Each tab definition is represented by this struct.
QDataStream & operator>>(QDataStream &in, QUrl &url)
Reads a url into url from the stream in and returns a reference to the stream.
QTextLength lengthProperty(int propertyId) const
Returns the value of the property given by propertyId.