![]() |
Qt 6.x
The Qt SDK
|
\reentrant More...
#include <qtextformat.h>
Public Member Functions | |
QTextFormat () | |
Creates a new text format with an InvalidFormat . | |
QTextFormat (int type) | |
Creates a new text format of the given type. | |
QTextFormat (const QTextFormat &rhs) | |
Creates a new text format with the same attributes as the other text format. | |
QTextFormat & | operator= (const QTextFormat &rhs) |
Assigns the other text format to this text format, and returns a reference to this text format. | |
~QTextFormat () | |
Destroys this text format. | |
void | swap (QTextFormat &other) |
void | merge (const QTextFormat &other) |
Merges the other format with this format; where there are conflicts the other format takes precedence. | |
bool | isValid () const |
Returns true if the format is valid (i.e. | |
bool | isEmpty () const |
int | type () const |
Returns the type of this format. | |
int | objectIndex () const |
Returns the index of the format object, or -1 if the format object is invalid. | |
void | setObjectIndex (int object) |
Sets the format object's object index. | |
QVariant | property (int propertyId) const |
Returns the property specified by the given propertyId. | |
void | setProperty (int propertyId, const QVariant &value) |
Sets the property specified by the propertyId to the given value. | |
void | clearProperty (int propertyId) |
Clears the value of the property given by propertyId. | |
bool | hasProperty (int propertyId) const |
Returns true if the text format has a property with the given propertyId; otherwise returns false . | |
bool | boolProperty (int propertyId) const |
Returns the value of the property specified by propertyId. | |
int | intProperty (int propertyId) const |
Returns the value of the property specified by propertyId. | |
qreal | doubleProperty (int propertyId) const |
Returns the value of the property specified by propertyId. | |
QString | stringProperty (int propertyId) const |
Returns the value of the property given by propertyId; if the property isn't of QMetaType::QString type, an empty string is returned instead. | |
QColor | colorProperty (int propertyId) const |
Returns the value of the property given by propertyId; if the property isn't of QMetaType::QColor type, an invalid color is returned instead. | |
QPen | penProperty (int propertyId) const |
Returns the value of the property given by propertyId; if the property isn't of QMetaType::QPen type, Qt::NoPen is returned instead. | |
QBrush | brushProperty (int propertyId) const |
Returns the value of the property given by propertyId; if the property isn't of QMetaType::QBrush type, Qt::NoBrush is returned instead. | |
QTextLength | lengthProperty (int propertyId) const |
Returns the value of the property given by propertyId. | |
QList< QTextLength > | lengthVectorProperty (int propertyId) const |
Returns the value of the property given by propertyId. | |
void | setProperty (int propertyId, const QList< QTextLength > &lengths) |
Sets the value of the property given by propertyId to value. | |
QMap< int, QVariant > | properties () const |
Returns a map with all properties of this text format. | |
int | propertyCount () const |
void | setObjectType (int type) |
Sets the text format's object type to type. | |
int | objectType () const |
Returns the text format's object type. | |
bool | isCharFormat () const |
Returns true if this text format is a CharFormat ; otherwise returns false . | |
bool | isBlockFormat () const |
Returns true if this text format is a BlockFormat ; otherwise returns false . | |
bool | isListFormat () const |
Returns true if this text format is a ListFormat ; otherwise returns false . | |
bool | isFrameFormat () const |
Returns true if this text format is a FrameFormat ; otherwise returns false . | |
bool | isImageFormat () const |
Returns true if this text format is an image format; otherwise returns false . | |
bool | isTableFormat () const |
Returns true if this text format is a TableFormat ; otherwise returns false . | |
bool | isTableCellFormat () const |
QTextBlockFormat | toBlockFormat () const |
Returns this format as a block format. | |
QTextCharFormat | toCharFormat () const |
Returns this format as a character format. | |
QTextListFormat | toListFormat () const |
Returns this format as a list format. | |
QTextTableFormat | toTableFormat () const |
Returns this format as a table format. | |
QTextFrameFormat | toFrameFormat () const |
Returns this format as a frame format. | |
QTextImageFormat | toImageFormat () const |
Returns this format as an image format. | |
QTextTableCellFormat | toTableCellFormat () const |
bool | operator== (const QTextFormat &rhs) const |
Returns true if this text format is the same as the other text format. | |
bool | operator!= (const QTextFormat &rhs) const |
Returns true if this text format is different from the other text format. | |
operator QVariant () const | |
Returns the text format as a QVariant. | |
void | setLayoutDirection (Qt::LayoutDirection direction) |
Sets the document's layout direction to the specified direction. | |
Qt::LayoutDirection | layoutDirection () const |
Returns the document's layout direction. | |
void | setBackground (const QBrush &brush) |
Sets the brush use to paint the document's background to the brush specified. | |
QBrush | background () const |
Returns the brush used to paint the document's background. | |
void | clearBackground () |
Clears the brush used to paint the document's background. | |
void | setForeground (const QBrush &brush) |
Sets the foreground brush to the specified brush. | |
QBrush | foreground () const |
Returns the brush used to render foreground details, such as text, frame outlines, and table borders. | |
void | clearForeground () |
Clears the brush used to paint the document's foreground. | |
Friends | |
class | QTextFormatCollection |
class | QTextCharFormat |
Q_GUI_EXPORT QDataStream & | operator<< (QDataStream &, const QTextFormat &) |
Q_GUI_EXPORT QDataStream & | operator>> (QDataStream &, QTextFormat &) |
\reentrant
The QTextFormat class provides formatting information for a QTextDocument. \inmodule QtGui
A QTextFormat is a generic class used for describing the format of parts of a QTextDocument. The derived classes QTextCharFormat, QTextBlockFormat, QTextListFormat, and QTextTableFormat are usually more useful, and describe the formatting that is applied to specific parts of the document.
A format has a FormatType
which specifies the kinds of text item it can format; e.g. a block of text, a list, a table, etc. A format also has various properties (some specific to particular format types), as described by the Property enum. Every property has a corresponding Property.
The format type is given by type(), and the format can be tested with isCharFormat(), isBlockFormat(), isListFormat(), isTableFormat(), isFrameFormat(), and isImageFormat(). If the type is determined, it can be retrieved with toCharFormat(), toBlockFormat(), toListFormat(), toTableFormat(), toFrameFormat(), and toImageFormat().
A format's properties can be set with the setProperty() functions, and retrieved with boolProperty(), intProperty(), doubleProperty(), and stringProperty() as appropriate. All the property IDs used in the format can be retrieved with allPropertyIds(). One format can be merged into another using merge().
A format's object index can be set with setObjectIndex(), and retrieved with objectIndex(). These methods can be used to associate the format with a QTextObject. It is used to represent lists, frames, and tables inside the document.
Definition at line 89 of file qtextformat.h.
This enum describes the text item a QTextFormat object is formatting.
\value InvalidFormat An invalid format as created by the default constructor \value BlockFormat The object formats a text block \value CharFormat The object formats a single character \value ListFormat The object formats a list \value FrameFormat The object formats a frame
\value UserFormat
Enumerator | |
---|---|
InvalidFormat | |
BlockFormat | |
CharFormat | |
ListFormat | |
FrameFormat | |
UserFormat |
Definition at line 93 of file qtextformat.h.
This enum describes what kind of QTextObject this format is associated with.
\value NoObject \value ImageObject \value TableObject \value TableCellObject \value UserObject The first object that can be used for application-specific purposes.
Enumerator | |
---|---|
NoObject | |
ImageObject | |
TableObject | |
TableCellObject | |
UserObject |
Definition at line 262 of file qtextformat.h.
This enum describes how page breaking is performed when printing. It maps to the corresponding css properties.
\value PageBreak_Auto The page break is determined automatically depending on the available space on the current page \value PageBreak_AlwaysBefore The page is always broken before the paragraph/table \value PageBreak_AlwaysAfter A new page is always started after the paragraph/table
Enumerator | |
---|---|
PageBreak_Auto | |
PageBreak_AlwaysBefore | |
PageBreak_AlwaysAfter |
Definition at line 272 of file qtextformat.h.
This enum describes the different properties a format can have.
\value ObjectIndex The index of the formatted object. See objectIndex().
Paragraph and character properties
\value CssFloat How a frame is located relative to the surrounding text \value LayoutDirection The layout direction of the text in the document (Qt::LayoutDirection).
\value OutlinePen \value ForegroundBrush \value BackgroundBrush \value BackgroundImageUrl
Paragraph properties
\value BlockAlignment \value BlockTopMargin \value BlockBottomMargin \value BlockLeftMargin \value BlockRightMargin \value TextIndent \value TabPositions Specifies the tab positions. The tab positions are structs of QTextOption::Tab which are stored in a QList (internally, in a QList<QVariant>). \value BlockIndent \value LineHeight \value LineHeightType \value BlockNonBreakableLines \value BlockTrailingHorizontalRulerWidth The width of a horizontal ruler element. \value HeadingLevel The level of a heading, for example 1 corresponds to an HTML H1 tag; otherwise 0. This enum value has been added in Qt 5.12. \value BlockCodeFence The character that was used in the "fences" around a Markdown code block. If the code block was indented rather than fenced, the block should not have this property. This enum value has been added in Qt 5.14.
\value BlockQuoteLevel The depth of nested quoting on this block: 1 means the block is a top-level block quote. Blocks that are not block quotes should not have this property. This enum value has been added in Qt 5.14. \value BlockCodeLanguage The programming language in a preformatted or code block. Blocks that do not contain code should not have this property. This enum value has been added in Qt 5.14. \value BlockMarker The \l{QTextBlockFormat::MarkerType}{type of adornment} to be shown alongside the block. This enum value has been added in Qt 5.14.
Character properties
\value FontFamily e{This property has been deprecated.} Use QTextFormat::FontFamilies instead. \omitvalue OldFontFamily \value FontFamilies \value FontStyleName \value FontPointSize \value FontPixelSize \value FontSizeAdjustment Specifies the change in size given to the fontsize already set using FontPointSize or FontPixelSize. \value FontFixedPitch \omitvalue FontSizeIncrement \value FontWeight \value FontItalic \value FontUnderline {This property has been deprecated.} Use QTextFormat::TextUnderlineStyle instead. \value FontOverline \value FontStrikeOut \value FontCapitalization Specifies the capitalization type that is to be applied to the text. \value FontLetterSpacingType Specifies the meaning of the FontLetterSpacing property. The default is QFont::PercentageSpacing. \value FontLetterSpacing Changes the default spacing between individual letters in the font. The value is specified as a percentage or absolute value, depending on FontLetterSpacingType. The default value is 100%. \value FontWordSpacing Changes the default spacing between individual words. A positive value increases the word spacing by the corresponding pixels; a negative value decreases the spacing. \value FontStretch Corresponds to the QFont::Stretch property \value FontStyleHint Corresponds to the QFont::StyleHint property \value FontStyleStrategy Corresponds to the QFont::StyleStrategy property \value FontKerning Specifies whether the font has kerning turned on. \value FontHintingPreference Controls the use of hinting according to values of the QFont::HintingPreference enum.
\omitvalue FirstFontProperty \omitvalue LastFontProperty
\value TextUnderlineColor Specifies the color to draw underlines, overlines and strikeouts. \value TextVerticalAlignment \value TextOutline \value TextUnderlineStyle \value TextToolTip Specifies the (optional) tool tip to be displayed for a fragment of text. \value TextSuperScriptBaseline Specifies the baseline (in % of height) of superscript texts. \value TextSubScriptBaseline Specifies the baseline (in % of height) of subscript texts. \value TextBaselineOffset Specifies the baseline (in % of height) of text. A positive value moves up the text, by the corresponding %; a negative value moves it down.
\value IsAnchor \value AnchorHref \value AnchorName \omitvalue OldFontLetterSpacingType \omitvalue OldFontStretch \omitvalue OldTextUnderlineColor \value ObjectType
List properties
\value ListStyle Specifies the style used for the items in a list, described by values of the QTextListFormat::Style enum. \value ListIndent Specifies the amount of indentation used for a list. \value ListNumberPrefix Defines the text which is prepended to item numbers in numeric lists. \value ListNumberSuffix Defines the text which is appended to item numbers in numeric lists. \value [since 6.6] ListStart Defines the first value of a list.
Table and frame properties
\value FrameBorder \value FrameBorderBrush \value FrameBorderStyle See the \l{QTextFrameFormat::BorderStyle}{BorderStyle} enum. \value FrameBottomMargin \value FrameHeight \value FrameLeftMargin \value FrameMargin \value FramePadding \value FrameRightMargin \value FrameTopMargin \value FrameWidth \value TableCellSpacing \value TableCellPadding \value TableColumns \value TableColumnWidthConstraints \value TableHeaderRowCount \value TableBorderCollapse Specifies the \l QTextTableFormat::borderCollapse property.
Table cell properties
\value TableCellRowSpan \value TableCellColumnSpan \value TableCellLeftPadding \value TableCellRightPadding \value TableCellTopPadding \value TableCellBottomPadding
Table cell properties intended for use with \l QTextTableFormat::borderCollapse enabled
\value TableCellTopBorder \value TableCellBottomBorder \value TableCellLeftBorder \value TableCellRightBorder
\value TableCellTopBorderStyle \value TableCellBottomBorderStyle \value TableCellLeftBorderStyle \value TableCellRightBorderStyle
\value TableCellTopBorderBrush \value TableCellBottomBorderBrush \value TableCellLeftBorderBrush \value TableCellRightBorderBrush
Image properties
\value ImageName The filename or source of the image. \value ImageTitle The title attribute of an HTML image tag, or the quoted string that comes after the URL in a Markdown image link. This enum value has been added in Qt 5.14. \value ImageAltText The alt attribute of an HTML image tag, or the image description in a Markdown image link. This enum value has been added in Qt 5.14. \value ImageWidth \value ImageHeight \value ImageQuality
Selection properties
\value FullWidthSelection When set on the characterFormat of a selection, the whole width of the text will be shown selected.
Page break properties
\value PageBreakPolicy Specifies how pages are broken. See the PageBreakFlag enum.
\value UserProperty
Definition at line 104 of file qtextformat.h.
QTextFormat::QTextFormat | ( | ) |
Creates a new text format with an InvalidFormat
.
Definition at line 871 of file qtextformat.cpp.
|
explicit |
Creates a new text format of the given type.
Definition at line 881 of file qtextformat.cpp.
QTextFormat::QTextFormat | ( | const QTextFormat & | rhs | ) |
Creates a new text format with the same attributes as the other text format.
Definition at line 893 of file qtextformat.cpp.
QTextFormat::~QTextFormat | ( | ) |
Destroys this text format.
Definition at line 922 of file qtextformat.cpp.
|
inline |
Returns the brush used to paint the document's background.
Definition at line 352 of file qtextformat.h.
Referenced by QQuickTextNodeEngine::addTextBlock(), QTextDocumentLayoutPrivate::drawBlock(), QTextDocumentLayoutPrivate::drawListItem(), QTextDocumentLayoutPrivate::drawTableCell(), QPlainTextEdit::paintEvent(), and setPenAndDrawBackground().
bool QTextFormat::boolProperty | ( | int | propertyId | ) | const |
Returns the value of the property specified by propertyId.
If the property isn't of QTextFormat::Bool type, false is returned instead.
Definition at line 1037 of file qtextformat.cpp.
References QTextFormatPrivate::property(), QVariant::toBool(), and QVariant::userType().
Referenced by QTextCharFormat::fontFixedPitch(), QTextCharFormat::fontItalic(), QTextCharFormat::fontKerning(), QTextCharFormat::fontOverline(), QTextCharFormat::fontStrikeOut(), QTextCharFormat::fontUnderline(), QTextItemInt::initWithScriptItem(), and QTextCharFormat::isAnchor().
QBrush QTextFormat::brushProperty | ( | int | propertyId | ) | const |
Returns the value of the property given by propertyId; if the property isn't of QMetaType::QBrush type, Qt::NoBrush is returned instead.
Definition at line 1147 of file qtextformat.cpp.
References Qt::NoBrush, QTextFormatPrivate::property(), and QVariant::userType().
|
inline |
Clears the brush used to paint the document's background.
The default brush will be used.
Definition at line 354 of file qtextformat.h.
|
inline |
Clears the brush used to paint the document's foreground.
The default brush will be used.
Definition at line 361 of file qtextformat.h.
void QTextFormat::clearProperty | ( | int | propertyId | ) |
Clears the value of the property given by propertyId.
Definition at line 1243 of file qtextformat.cpp.
References QTextFormatPrivate::clearProperty().
Referenced by QTextCursor::charFormat(), formatDifference(), QTextHtmlParserNode::initializeProperties(), QTextCursor::insertBlock(), QTextCursor::insertBlock(), QWidgetTextControlPrivate::insertParagraphSeparator(), QTextCursor::insertText(), QTextCursorPrivate::setBlockCharFormat(), QTextCursorPrivate::setCharFormat(), QTextDocumentPrivate::setCharFormat(), setProperty(), QTextCharFormat::setTableCellColumnSpan(), QTextCharFormat::setTableCellRowSpan(), and QTextHtmlExporter::toHtml().
QColor QTextFormat::colorProperty | ( | int | propertyId | ) | const |
Returns the value of the property given by propertyId; if the property isn't of QMetaType::QColor type, an invalid color is returned instead.
Definition at line 1111 of file qtextformat.cpp.
References QTextFormatPrivate::property(), and QVariant::userType().
Referenced by QTextCharFormat::underlineColor().
qreal QTextFormat::doubleProperty | ( | int | propertyId | ) | const |
Returns the value of the property specified by propertyId.
If the property isn't of QMetaType::Double or QMetaType::Float type, 0 is returned instead.
Definition at line 1075 of file qtextformat.cpp.
References QTextFormatPrivate::property(), and QVariant::userType().
Referenced by QTextCharFormat::baselineOffset(), QTextFrameFormat::bottomMargin(), QTextTableCellFormat::bottomPadding(), QTextCharFormat::fontLetterSpacing(), QTextCharFormat::fontPointSize(), QTextCharFormat::fontWordSpacing(), QTextFrameFormat::leftMargin(), QTextTableCellFormat::leftPadding(), QTextBlockFormat::lineHeight(), QTextFrameFormat::rightMargin(), QTextTableCellFormat::rightPadding(), QTextCharFormat::subScriptBaseline(), QTextCharFormat::superScriptBaseline(), QTextFrameFormat::topMargin(), and QTextTableCellFormat::topPadding().
|
inline |
Returns the brush used to render foreground details, such as text, frame outlines, and table borders.
Definition at line 359 of file qtextformat.h.
Referenced by QQuickTextNodeEngine::addText(), QQuickTextNodeEngine::addTextBlock(), QTextMarkdownImporter::cbEnterSpan(), QTextMarkdownImporter::cbLeaveSpan(), QTextDocumentLayoutPrivate::drawListItem(), and setPenAndDrawBackground().
bool QTextFormat::hasProperty | ( | int | propertyId | ) | const |
Returns true
if the text format has a property with the given propertyId; otherwise returns false
.
Definition at line 1310 of file qtextformat.cpp.
References QTextFormatPrivate::hasProperty().
Referenced by QQuickTextNodeEngine::addFrameDecorations(), QQuickTextNodeEngine::addTextBlock(), QTextCharFormat::baselineOffset(), QAbstractTextDocumentLayout::blockWithMarkerAt(), QTextFrameFormat::bottomMargin(), QTextMarkdownImporter::cbText(), QTextDocumentLayoutPrivate::drawBlock(), QTextDocumentLayoutPrivate::drawListItem(), QPdfEnginePrivate::drawTextItem(), QTextCharFormat::fontUnderline(), QTextCharFormat::fontWeight(), QTextHtmlImporter::import(), QTextItemInt::initWithScriptItem(), QWidgetTextControlPrivate::insertParagraphSeparator(), QQuickTextDocumentWithImageResources::intrinsicSize(), QTextEngine::itemize(), QTextDocumentLayoutPrivate::layoutBlock(), QTextFrameFormat::leftMargin(), QTextFrameFormat::rightMargin(), QTextCharFormat::subScriptBaseline(), QTextCharFormat::superScriptBaseline(), QTextHtmlExporter::toHtml(), QTextFrameFormat::topMargin(), QTextMarkdownWriter::writeBlock(), QTextMarkdownWriter::writeFrame(), and QTextOdfWriter::writeInlineCharacter().
int QTextFormat::intProperty | ( | int | propertyId | ) | const |
Returns the value of the property specified by propertyId.
If the property is not of QTextFormat::Integer type, 0 is returned instead.
Definition at line 1054 of file qtextformat.cpp.
References LayoutDirection, Qt::LayoutDirectionAuto, QTextFormatPrivate::property(), QVariant::toInt(), and QVariant::userType().
Referenced by QTextMarkdownImporter::cbText(), QTextDocumentLayoutPrivate::drawListItem(), QTextCharFormat::fontCapitalization(), QTextCharFormat::fontHintingPreference(), QTextCharFormat::fontLetterSpacingType(), QTextCharFormat::fontStretch(), QTextCharFormat::fontStyleHint(), QTextCharFormat::fontStyleStrategy(), QTextCharFormat::fontWeight(), QTextBlockFormat::lineHeight(), QTextCharFormat::tableCellColumnSpan(), QTextCharFormat::tableCellRowSpan(), QTextHtmlExporter::toHtml(), QTextCharFormat::underlineStyle(), QTextCharFormat::verticalAlignment(), and QTextMarkdownWriter::writeBlock().
|
inline |
Returns true
if this text format is a BlockFormat
; otherwise returns false
.
Definition at line 326 of file qtextformat.h.
|
inline |
Returns true
if this text format is a CharFormat
; otherwise returns false
.
Definition at line 325 of file qtextformat.h.
Referenced by QTextCharFormat::isValid().
|
inline |
Returns true if the format does not store any properties; false otherwise.
Definition at line 294 of file qtextformat.h.
|
inline |
Returns true
if this text format is a FrameFormat
; otherwise returns false
.
Definition at line 328 of file qtextformat.h.
|
inline |
Returns true
if this text format is an image format; otherwise returns false
.
Definition at line 329 of file qtextformat.h.
Referenced by QTextOdfWriter::writeInlineCharacter().
|
inline |
Returns true
if this text format is a ListFormat
; otherwise returns false
.
Definition at line 327 of file qtextformat.h.
|
inline |
Returns true
if this text format is a TableCellFormat
; otherwise returns false
.
Definition at line 331 of file qtextformat.h.
Referenced by QTextOdfWriter::writeFormats(), and QTextOdfWriter::writeFrame().
|
inline |
Returns true
if this text format is a TableFormat
; otherwise returns false
.
Definition at line 330 of file qtextformat.h.
Referenced by QTextOdfWriter::writeFormats().
|
inline |
Returns true
if the format is valid (i.e.
is not InvalidFormat); otherwise returns false
.
Definition at line 293 of file qtextformat.h.
|
inline |
Returns the document's layout direction.
Definition at line 347 of file qtextformat.h.
References LayoutDirection.
QTextLength QTextFormat::lengthProperty | ( | int | propertyId | ) | const |
Returns the value of the property given by propertyId.
Definition at line 1163 of file qtextformat.cpp.
References QTextFormatPrivate::property().
Referenced by QTextDocumentLayoutPrivate::drawBlock().
QList< QTextLength > QTextFormat::lengthVectorProperty | ( | int | propertyId | ) | const |
Returns the value of the property given by propertyId.
If the property isn't of QTextFormat::LengthVector type, an empty list is returned instead.
Definition at line 1178 of file qtextformat.cpp.
References QList< T >::append(), list, QTextFormatPrivate::property(), QVariant::toList(), QVariant::userType(), and var.
void QTextFormat::merge | ( | const QTextFormat & | other | ) |
Merges the other format with this format; where there are conflicts the other format takes precedence.
Definition at line 939 of file qtextformat.cpp.
References QList< T >::at(), QSharedDataPointer< T >::data(), i, other(), QT_PREPEND_NAMESPACE(), and QList< T >::size().
Referenced by QWidgetTextControlPrivate::inputMethodEvent(), and QTextDocumentPrivate::setCharFormat().
int QTextFormat::objectIndex | ( | ) | const |
Returns the index of the format object, or -1 if the format object is invalid.
Definition at line 1274 of file qtextformat.cpp.
References ObjectIndex, QTextFormatPrivate::property(), QVariant::toInt(), and QVariant::userType().
Referenced by QTextDocumentPrivate::objectForFormat().
|
inline |
Returns the text format's object type.
Definition at line 322 of file qtextformat.h.
QTextFormat::operator QVariant | ( | ) | const |
Returns the text format as a QVariant.
Definition at line 930 of file qtextformat.cpp.
References QVariant::fromValue().
|
inline |
Returns true
if this text format is different from the other text format.
Definition at line 342 of file qtextformat.h.
References operator==().
QTextFormat & QTextFormat::operator= | ( | const QTextFormat & | rhs | ) |
Assigns the other text format to this text format, and returns a reference to this text format.
Definition at line 904 of file qtextformat.cpp.
bool QTextFormat::operator== | ( | const QTextFormat & | rhs | ) | const |
Returns true
if this text format is the same as the other text format.
Definition at line 1357 of file qtextformat.cpp.
References QList< T >::isEmpty(), and QTextFormatPrivate::props.
QPen QTextFormat::penProperty | ( | int | propertyId | ) | const |
Returns the value of the property given by propertyId; if the property isn't of QMetaType::QPen type, Qt::NoPen is returned instead.
Definition at line 1129 of file qtextformat.cpp.
References Qt::NoPen, QTextFormatPrivate::property(), and QVariant::userType().
Referenced by QTextCharFormat::textOutline().
Returns a map with all properties of this text format.
Definition at line 1324 of file qtextformat.cpp.
References QList< T >::at(), i, QMap< Key, T >::insert(), map, QTextFormatPrivate::props, and QList< T >::size().
Referenced by formatDifference().
QVariant QTextFormat::property | ( | int | propertyId | ) | const |
Returns the property specified by the given propertyId.
Definition at line 1201 of file qtextformat.cpp.
References QTextFormatPrivate::property().
Referenced by QQuickTextNodeEngine::addTextBlock(), cellEdgeData(), QTextDocumentLayoutPrivate::drawBlock(), formatDifference(), setPenAndDrawBackground(), and QTextMarkdownWriter::writeFrame().
int QTextFormat::propertyCount | ( | ) | const |
Definition at line 1338 of file qtextformat.cpp.
References QTextFormatPrivate::props, and QList< T >::size().
Sets the brush use to paint the document's background to the brush specified.
Definition at line 350 of file qtextformat.h.
References setProperty().
Referenced by QTextHtmlParser::applyAttributes(), QTextHtmlParserNode::applyBackgroundImage(), MainWindow::highlightListItems(), and main_textblock_formats().
Sets the foreground brush to the specified brush.
The foreground brush is mostly used to render text.
Definition at line 357 of file qtextformat.h.
References setProperty().
Referenced by QTextHtmlParser::applyAttributes(), QTextHtmlParserNode::applyForegroundImage(), QTextMarkdownImporter::cbEnterSpan(), src_gui_text_qsyntaxhighlighter::MyHighlighter::highlightBlock(), main(), and src_gui_text_qsyntaxhighlighter::MyHighlighter::wrapper().
|
inline |
Sets the document's layout direction to the specified direction.
Definition at line 345 of file qtextformat.h.
References direction, LayoutDirection, and setProperty().
Referenced by QTextHtmlParser::applyAttributes(), and QTextHtmlParserNode::initializeProperties().
void QTextFormat::setObjectIndex | ( | int | index | ) |
Sets the format object's object index.
Definition at line 1291 of file qtextformat.cpp.
References QTextFormatPrivate::clearProperty(), QSharedDataPointer< T >::constData(), QTextFormatPrivate::insertProperty(), o, and ObjectIndex.
Referenced by QTextCursor::createList(), QTextTablePrivate::createTable(), QTextDocumentPrivate::insertFrame(), and QTextDocumentPrivate::setCharFormat().
|
inline |
Sets the text format's object type to type.
Definition at line 376 of file qtextformat.h.
References ObjectType, and setProperty().
Referenced by QTextImageFormat::QTextImageFormat(), QTextTableCellFormat::QTextTableCellFormat(), QTextTableFormat::QTextTableFormat(), and QTextTablePrivate::createTable().
void QTextFormat::setProperty | ( | int | propertyId, |
const QList< QTextLength > & | value | ||
) |
Sets the value of the property given by propertyId to value.
Definition at line 1226 of file qtextformat.cpp.
References QList< T >::at(), i, QTextFormatPrivate::insertProperty(), list, QList< T >::reserve(), and QList< T >::size().
Sets the property specified by the propertyId to the given value.
Definition at line 1211 of file qtextformat.cpp.
References clearProperty(), and QTextFormatPrivate::insertProperty().
Referenced by QTextHtmlParser::applyAttributes(), QTextHtmlParserNode::applyBackgroundImage(), QTextMarkdownImporter::cbEnterBlock(), QTextMarkdownImporter::cbEnterSpan(), QTextMarkdownImporter::cbText(), QTextHtmlParserNode::initializeProperties(), QTextTableFormat::setAlignment(), QTextFrameFormat::setBottomMargin(), QTextTableCellFormat::setBottomPadding(), QTextTableFormat::setCellPadding(), QTextCharFormat::setFont(), QTextFrameFormat::setHeight(), QTextImageFormat::setHeight(), QTextFrameFormat::setHeight(), QTextBlockFormat::setIndent(), QTextListFormat::setIndent(), QTextFrameFormat::setLeftMargin(), QTextTableCellFormat::setLeftPadding(), QTextFrameFormat::setMargin(), QTextListFormat::setNumberPrefix(), QTextListFormat::setNumberSuffix(), QTextFrameFormat::setPadding(), QTextImageFormat::setQuality(), QTextFrameFormat::setRightMargin(), QTextTableCellFormat::setRightPadding(), QTextListFormat::setStart(), QTextCharFormat::setTableCellColumnSpan(), QTextBlockFormat::setTabPositions(), QTextFrameFormat::setTopMargin(), QTextCharFormat::setUnderlineStyle(), QTextImageFormat::setWidth(), QTextFrameFormat::setWidth(), and QtWaylandClient::QWaylandTextInputMethod::text_input_method_v1_input_method_event_attribute().
QString QTextFormat::stringProperty | ( | int | propertyId | ) | const |
Returns the value of the property given by propertyId; if the property isn't of QMetaType::QString type, an empty string is returned instead.
Definition at line 1093 of file qtextformat.cpp.
References QTextFormatPrivate::property(), QVariant::toString(), and QVariant::userType().
Referenced by QTextCharFormat::anchorHref(), QTextMarkdownImporter::cbText(), QTextCharFormat::toolTip(), and QTextMarkdownWriter::writeBlock().
|
inline |
Swaps this text format with other. This function is very fast and never fails.
Definition at line 288 of file qtextformat.h.
QTextBlockFormat QTextFormat::toBlockFormat | ( | ) | const |
Returns this format as a block format.
Definition at line 975 of file qtextformat.cpp.
Referenced by QTextBlock::blockFormat(), and QTextOdfWriter::writeFormats().
QTextCharFormat QTextFormat::toCharFormat | ( | ) | const |
Returns this format as a character format.
Definition at line 983 of file qtextformat.cpp.
References QTextCharFormat.
Referenced by QAbstractTextDocumentLayout::anchorAt(), QTextBlock::charFormat(), QTextDocumentLayout::drawInlineObject(), QAbstractTextDocumentLayout::drawInlineObject(), QTextDocumentLayout::positionInlineObject(), QWidgetLineControl::processInputMethodEvent(), QAbstractTextDocumentLayout::resizeInlineObject(), QTextDocumentLayout::resizeInlineObject(), and QTextOdfWriter::writeFormats().
QTextFrameFormat QTextFormat::toFrameFormat | ( | ) | const |
Returns this format as a frame format.
Definition at line 1007 of file qtextformat.cpp.
Referenced by QTextFrame::frameFormat(), and QTextOdfWriter::writeFormats().
QTextImageFormat QTextFormat::toImageFormat | ( | ) | const |
Returns this format as an image format.
Definition at line 1015 of file qtextformat.cpp.
Referenced by QQuickTextNodeEngine::addTextObject(), QTextImageHandler::drawObject(), QAbstractTextDocumentLayout::imageAt(), QTextImageHandler::intrinsicSize(), QQuickTextDocumentWithImageResources::intrinsicSize(), main(), and QTextOdfWriter::writeInlineCharacter().
QTextListFormat QTextFormat::toListFormat | ( | ) | const |
Returns this format as a list format.
Definition at line 991 of file qtextformat.cpp.
Referenced by QTextDocumentLayoutPrivate::blockIndent(), QTextDocumentLayoutPrivate::drawListItem(), QTextList::format(), and QTextOdfWriter::writeFormats().
QTextTableCellFormat QTextFormat::toTableCellFormat | ( | ) | const |
Returns this format as a table cell format.
Definition at line 1025 of file qtextformat.cpp.
Referenced by cellEdgeData(), drawCellBorder(), and QTextOdfWriter::writeFormats().
QTextTableFormat QTextFormat::toTableFormat | ( | ) | const |
Returns this format as a table format.
Definition at line 999 of file qtextformat.cpp.
Referenced by QTextTable::format(), QTextOdfWriter::writeFormats(), and QTextOdfWriter::writeTableCellFormat().
int QTextFormat::type | ( | ) | const |
Returns the type of this format.
Definition at line 967 of file qtextformat.cpp.
Referenced by QTextOdfWriter::writeFormats().
|
friend |
Definition at line 404 of file qtextformat.cpp.
|
friend |
Definition at line 437 of file qtextformat.cpp.
|
friend |
Definition at line 369 of file qtextformat.h.
Referenced by toCharFormat().
|
friend |
Definition at line 368 of file qtextformat.h.