QtBase  v6.3.1
Public Types | Public Member Functions | Friends | List of all members
QTextFormat Class Reference

The QTextFormat class provides formatting information for a QTextDocument. \inmodule QtGui. More...

#include <qtextformat.h>

Inheritance diagram for QTextFormat:
Inheritance graph
[legend]

Public Types

enum  FormatType {
  InvalidFormat = -1 , BlockFormat = 1 , CharFormat = 2 , ListFormat = 3 ,
  FrameFormat = 5 , UserFormat = 100
}
 
enum  Property {
  ObjectIndex = 0x0 , CssFloat = 0x0800 , LayoutDirection = 0x0801 , OutlinePen = 0x810 ,
  BackgroundBrush = 0x820 , ForegroundBrush = 0x821 , BackgroundImageUrl = 0x823 , BlockAlignment = 0x1010 ,
  BlockTopMargin = 0x1030 , BlockBottomMargin = 0x1031 , BlockLeftMargin = 0x1032 , BlockRightMargin = 0x1033 ,
  TextIndent = 0x1034 , TabPositions = 0x1035 , BlockIndent = 0x1040 , LineHeight = 0x1048 ,
  LineHeightType = 0x1049 , BlockNonBreakableLines = 0x1050 , BlockTrailingHorizontalRulerWidth = 0x1060 , HeadingLevel = 0x1070 ,
  BlockQuoteLevel = 0x1080 , BlockCodeLanguage = 0x1090 , BlockCodeFence = 0x1091 , BlockMarker = 0x10A0 ,
  FirstFontProperty = 0x1FE0 , FontCapitalization = FirstFontProperty , FontLetterSpacing = 0x1FE1 , FontWordSpacing = 0x1FE2 ,
  FontStyleHint = 0x1FE3 , FontStyleStrategy = 0x1FE4 , FontKerning = 0x1FE5 , FontHintingPreference = 0x1FE6 ,
  FontFamilies = 0x1FE7 , FontStyleName = 0x1FE8 , FontLetterSpacingType = 0x1FE9 , FontStretch = 0x1FEA ,
  FontPointSize = 0x2001 , FontSizeAdjustment = 0x2002 , FontSizeIncrement = FontSizeAdjustment , FontWeight = 0x2003 ,
  FontItalic = 0x2004 , FontUnderline = 0x2005 , FontOverline = 0x2006 , FontStrikeOut = 0x2007 ,
  FontFixedPitch = 0x2008 , FontPixelSize = 0x2009 , LastFontProperty = FontPixelSize , TextUnderlineColor = 0x2020 ,
  TextVerticalAlignment = 0x2021 , TextOutline = 0x2022 , TextUnderlineStyle = 0x2023 , TextToolTip = 0x2024 ,
  TextSuperScriptBaseline = 0x2025 , TextSubScriptBaseline = 0x2026 , TextBaselineOffset = 0x2027 , IsAnchor = 0x2030 ,
  AnchorHref = 0x2031 , AnchorName = 0x2032 , OldFontLetterSpacingType = 0x2033 , OldFontStretch = 0x2034 ,
  OldTextUnderlineColor = 0x2010 , ObjectType = 0x2f00 , ListStyle = 0x3000 , ListIndent = 0x3001 ,
  ListNumberPrefix = 0x3002 , ListNumberSuffix = 0x3003 , FrameBorder = 0x4000 , FrameMargin = 0x4001 ,
  FramePadding = 0x4002 , FrameWidth = 0x4003 , FrameHeight = 0x4004 , FrameTopMargin = 0x4005 ,
  FrameBottomMargin = 0x4006 , FrameLeftMargin = 0x4007 , FrameRightMargin = 0x4008 , FrameBorderBrush = 0x4009 ,
  FrameBorderStyle = 0x4010 , TableColumns = 0x4100 , TableColumnWidthConstraints = 0x4101 , TableCellSpacing = 0x4102 ,
  TableCellPadding = 0x4103 , TableHeaderRowCount = 0x4104 , TableBorderCollapse = 0x4105 , TableCellRowSpan = 0x4810 ,
  TableCellColumnSpan = 0x4811 , TableCellTopPadding = 0x4812 , TableCellBottomPadding = 0x4813 , TableCellLeftPadding = 0x4814 ,
  TableCellRightPadding = 0x4815 , TableCellTopBorder = 0x4816 , TableCellBottomBorder = 0x4817 , TableCellLeftBorder = 0x4818 ,
  TableCellRightBorder = 0x4819 , TableCellTopBorderStyle = 0x481a , TableCellBottomBorderStyle = 0x481b , TableCellLeftBorderStyle = 0x481c ,
  TableCellRightBorderStyle = 0x481d , TableCellTopBorderBrush = 0x481e , TableCellBottomBorderBrush = 0x481f , TableCellLeftBorderBrush = 0x4820 ,
  TableCellRightBorderBrush = 0x4821 , ImageName = 0x5000 , ImageTitle = 0x5001 , ImageAltText = 0x5002 ,
  ImageWidth = 0x5010 , ImageHeight = 0x5011 , ImageQuality = 0x5014 , FullWidthSelection = 0x06000 ,
  PageBreakPolicy = 0x7000 , UserProperty = 0x100000
}
 
enum  ObjectTypes {
  NoObject , ImageObject , TableObject , TableCellObject ,
  UserObject = 0x1000
}
 
enum  PageBreakFlag { PageBreak_Auto = 0 , PageBreak_AlwaysBefore = 0x001 , PageBreak_AlwaysAfter = 0x010 }
 

Public Member Functions

 QTextFormat ()
 
 QTextFormat (int type)
 
 QTextFormat (const QTextFormat &rhs)
 
QTextFormatoperator= (const QTextFormat &rhs)
 
 ~QTextFormat ()
 
void swap (QTextFormat &other)
 
void merge (const QTextFormat &other)
 
bool isValid () const
 
bool isEmpty () const
 
int type () const
 
int objectIndex () const
 
void setObjectIndex (int object)
 
QVariant property (int propertyId) const
 
void setProperty (int propertyId, const QVariant &value)
 
void clearProperty (int propertyId)
 
bool hasProperty (int propertyId) const
 
bool boolProperty (int propertyId) const
 
int intProperty (int propertyId) const
 
qreal doubleProperty (int propertyId) const
 
QString stringProperty (int propertyId) const
 
QColor colorProperty (int propertyId) const
 
QPen penProperty (int propertyId) const
 
QBrush brushProperty (int propertyId) const
 
QTextLength lengthProperty (int propertyId) const
 
QList< QTextLengthlengthVectorProperty (int propertyId) const
 
void setProperty (int propertyId, const QList< QTextLength > &lengths)
 
QMap< int, QVariantproperties () const
 
int propertyCount () const
 
void setObjectType (int type)
 
int objectType () const
 
bool isCharFormat () const
 
bool isBlockFormat () const
 
bool isListFormat () const
 
bool isFrameFormat () const
 
bool isImageFormat () const
 
bool isTableFormat () const
 
bool isTableCellFormat () const
 
QTextBlockFormat toBlockFormat () const
 
QTextCharFormat toCharFormat () const
 
QTextListFormat toListFormat () const
 
QTextTableFormat toTableFormat () const
 
QTextFrameFormat toFrameFormat () const
 
QTextImageFormat toImageFormat () const
 
QTextTableCellFormat toTableCellFormat () const
 
bool operator== (const QTextFormat &rhs) const
 
bool operator!= (const QTextFormat &rhs) const
 
 operator QVariant () const
 
void setLayoutDirection (Qt::LayoutDirection direction)
 
Qt::LayoutDirection layoutDirection () const
 
void setBackground (const QBrush &brush)
 
QBrush background () const
 
void clearBackground ()
 
void setForeground (const QBrush &brush)
 
QBrush foreground () const
 
void clearForeground ()
 

Friends

class QTextFormatCollection
 
class QTextCharFormat
 
Q_GUI_EXPORT QDataStreamoperator<< (QDataStream &, const QTextFormat &)
 
Q_GUI_EXPORT QDataStreamoperator>> (QDataStream &, QTextFormat &)
 

Detailed Description

The QTextFormat class provides formatting information for a QTextDocument. \inmodule QtGui.

\reentrant

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.

See also
{Rich Text Processing}

Definition at line 125 of file qtextformat.h.

Member Enumeration Documentation

◆ FormatType

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

See also
QTextCharFormat, QTextBlockFormat, QTextListFormat, QTextTableFormat, type()
Enumerator
InvalidFormat 
BlockFormat 
CharFormat 
ListFormat 
FrameFormat 
UserFormat 

Definition at line 129 of file qtextformat.h.

◆ ObjectTypes

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.

See also
QTextObject, QTextTable, QTextObject::format()
Enumerator
NoObject 
ImageObject 
TableObject 
TableCellObject 
UserObject 

Definition at line 296 of file qtextformat.h.

◆ PageBreakFlag

Since
4.2

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

See also
QTextBlockFormat::pageBreakPolicy(), QTextFrameFormat::pageBreakPolicy(), PageBreakPolicy
Enumerator
PageBreak_Auto 
PageBreak_AlwaysBefore 
PageBreak_AlwaysAfter 

Definition at line 306 of file qtextformat.h.

◆ Property

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. \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.

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

See also
property(), setProperty()
Enumerator
ObjectIndex 
CssFloat 
LayoutDirection 
OutlinePen 
BackgroundBrush 
ForegroundBrush 
BackgroundImageUrl 
BlockAlignment 
BlockTopMargin 
BlockBottomMargin 
BlockLeftMargin 
BlockRightMargin 
TextIndent 
TabPositions 
BlockIndent 
LineHeight 
LineHeightType 
BlockNonBreakableLines 
BlockTrailingHorizontalRulerWidth 
HeadingLevel 
BlockQuoteLevel 
BlockCodeLanguage 
BlockCodeFence 
BlockMarker 
FirstFontProperty 
FontCapitalization 
FontLetterSpacing 
FontWordSpacing 
FontStyleHint 
FontStyleStrategy 
FontKerning 
FontHintingPreference 
FontFamilies 
FontStyleName 
FontLetterSpacingType 
FontStretch 
FontPointSize 
FontSizeAdjustment 
FontSizeIncrement 
FontWeight 
FontItalic 
FontUnderline 
FontOverline 
FontStrikeOut 
FontFixedPitch 
FontPixelSize 
LastFontProperty 
TextUnderlineColor 
TextVerticalAlignment 
TextOutline 
TextUnderlineStyle 
TextToolTip 
TextSuperScriptBaseline 
TextSubScriptBaseline 
TextBaselineOffset 
IsAnchor 
AnchorHref 
AnchorName 
OldFontLetterSpacingType 
OldFontStretch 
OldTextUnderlineColor 
ObjectType 
ListStyle 
ListIndent 
ListNumberPrefix 
ListNumberSuffix 
FrameBorder 
FrameMargin 
FramePadding 
FrameWidth 
FrameHeight 
FrameTopMargin 
FrameBottomMargin 
FrameLeftMargin 
FrameRightMargin 
FrameBorderBrush 
FrameBorderStyle 
TableColumns 
TableColumnWidthConstraints 
TableCellSpacing 
TableCellPadding 
TableHeaderRowCount 
TableBorderCollapse 
TableCellRowSpan 
TableCellColumnSpan 
TableCellTopPadding 
TableCellBottomPadding 
TableCellLeftPadding 
TableCellRightPadding 
TableCellTopBorder 
TableCellBottomBorder 
TableCellLeftBorder 
TableCellRightBorder 
TableCellTopBorderStyle 
TableCellBottomBorderStyle 
TableCellLeftBorderStyle 
TableCellRightBorderStyle 
TableCellTopBorderBrush 
TableCellBottomBorderBrush 
TableCellLeftBorderBrush 
TableCellRightBorderBrush 
ImageName 
ImageTitle 
ImageAltText 
ImageWidth 
ImageHeight 
ImageQuality 
FullWidthSelection 
PageBreakPolicy 
UserProperty 

Definition at line 140 of file qtextformat.h.

Constructor & Destructor Documentation

◆ QTextFormat() [1/3]

QTextFormat::QTextFormat ( )

Creates a new text format with an InvalidFormat.

See also
FormatType

Definition at line 904 of file qtextformat.cpp.

◆ QTextFormat() [2/3]

QTextFormat::QTextFormat ( int  type)
explicit

Creates a new text format of the given type.

See also
FormatType

Definition at line 914 of file qtextformat.cpp.

◆ QTextFormat() [3/3]

QTextFormat::QTextFormat ( const QTextFormat other)

Creates a new text format with the same attributes as the other text format.

Definition at line 926 of file qtextformat.cpp.

◆ ~QTextFormat()

QTextFormat::~QTextFormat ( )

Destroys this text format.

Definition at line 955 of file qtextformat.cpp.

Member Function Documentation

◆ background()

QColor QTextFormat::background ( ) const
inline

Returns the brush used to paint the document's background.

See also
setBackground(), clearBackground(), foreground()

Definition at line 386 of file qtextformat.h.

Here is the caller graph for this function:

◆ boolProperty()

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.

See also
setProperty(), intProperty(), doubleProperty(), stringProperty(), colorProperty(), lengthProperty(), lengthVectorProperty(), Property

Definition at line 1070 of file qtextformat.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ brushProperty()

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.

See also
setProperty(), boolProperty(), intProperty(), doubleProperty(), stringProperty(), lengthProperty(), lengthVectorProperty(), Property

Definition at line 1180 of file qtextformat.cpp.

Here is the call graph for this function:

◆ clearBackground()

void QTextFormat::clearBackground ( )
inline

Clears the brush used to paint the document's background. The default brush will be used.

See also
background(), setBackground(), clearForeground()

Definition at line 388 of file qtextformat.h.

◆ clearForeground()

void QTextFormat::clearForeground ( )
inline

Clears the brush used to paint the document's foreground. The default brush will be used.

See also
foreground(), setForeground(), clearBackground()

Definition at line 395 of file qtextformat.h.

◆ clearProperty()

void QTextFormat::clearProperty ( int  propertyId)

Clears the value of the property given by propertyId

See also
Property

Definition at line 1276 of file qtextformat.cpp.

Here is the caller graph for this function:

◆ colorProperty()

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.

See also
setProperty(), boolProperty(), intProperty(), doubleProperty(), stringProperty(), lengthProperty(), lengthVectorProperty(), Property

Definition at line 1144 of file qtextformat.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ doubleProperty()

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.

See also
setProperty(), boolProperty(), intProperty(), stringProperty(), colorProperty(), lengthProperty(), lengthVectorProperty(), Property

Definition at line 1108 of file qtextformat.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ foreground()

QBrush QTextFormat::foreground ( ) const
inline

Returns the brush used to render foreground details, such as text, frame outlines, and table borders.

See also
setForeground(), clearForeground(), background()

Definition at line 393 of file qtextformat.h.

Here is the caller graph for this function:

◆ hasProperty()

bool QTextFormat::hasProperty ( int  propertyId) const

Returns true if the text format has a property with the given propertyId; otherwise returns false.

See also
properties(), Property

Definition at line 1343 of file qtextformat.cpp.

Here is the caller graph for this function:

◆ intProperty()

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.

See also
setProperty(), boolProperty(), doubleProperty(), stringProperty(), colorProperty(), lengthProperty(), lengthVectorProperty(), Property

Definition at line 1087 of file qtextformat.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isBlockFormat()

bool QTextFormat::isBlockFormat ( ) const
inline

Returns true if this text format is a BlockFormat; otherwise returns false.

Definition at line 360 of file qtextformat.h.

Here is the caller graph for this function:

◆ isCharFormat()

bool QTextFormat::isCharFormat ( ) const
inline

Returns true if this text format is a CharFormat; otherwise returns false.

Definition at line 359 of file qtextformat.h.

Here is the caller graph for this function:

◆ isEmpty()

bool QTextFormat::isEmpty ( ) const
inline
Since
5.3

Returns true if the format does not store any properties; false otherwise.

See also
propertyCount(), properties()

Definition at line 328 of file qtextformat.h.

◆ isFrameFormat()

bool QTextFormat::isFrameFormat ( ) const
inline

Returns true if this text format is a FrameFormat; otherwise returns false.

Definition at line 362 of file qtextformat.h.

◆ isImageFormat()

bool QTextFormat::isImageFormat ( ) const
inline

Returns true if this text format is an image format; otherwise returns false.

Definition at line 363 of file qtextformat.h.

Here is the caller graph for this function:

◆ isListFormat()

bool QTextFormat::isListFormat ( ) const
inline

Returns true if this text format is a ListFormat; otherwise returns false.

Definition at line 361 of file qtextformat.h.

◆ isTableCellFormat()

bool QTextFormat::isTableCellFormat ( ) const
inline
Since
4.4

Returns true if this text format is a TableCellFormat; otherwise returns false.

Definition at line 365 of file qtextformat.h.

Here is the caller graph for this function:

◆ isTableFormat()

bool QTextFormat::isTableFormat ( ) const
inline

Returns true if this text format is a TableFormat; otherwise returns false.

Definition at line 364 of file qtextformat.h.

◆ isValid()

bool QTextFormat::isValid ( ) const
inline

Returns true if the format is valid (i.e. is not InvalidFormat); otherwise returns false.

Definition at line 327 of file qtextformat.h.

◆ layoutDirection()

Qt::LayoutDirection QTextFormat::layoutDirection ( ) const
inline

Returns the document's layout direction.

See also
setLayoutDirection()

Definition at line 381 of file qtextformat.h.

◆ lengthProperty()

QTextLength QTextFormat::lengthProperty ( int  propertyId) const

Returns the value of the property given by propertyId.

See also
setProperty(), boolProperty(), intProperty(), doubleProperty(), stringProperty(), colorProperty(), lengthVectorProperty(), Property

Definition at line 1196 of file qtextformat.cpp.

◆ lengthVectorProperty()

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.

See also
setProperty(), boolProperty(), intProperty(), doubleProperty(), stringProperty(), colorProperty(), lengthProperty(), Property

Definition at line 1211 of file qtextformat.cpp.

Here is the call graph for this function:

◆ merge()

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 972 of file qtextformat.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ objectIndex()

int QTextFormat::objectIndex ( ) const

Returns the index of the format object, or -1 if the format object is invalid.

See also
setObjectIndex()

Definition at line 1307 of file qtextformat.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ objectType()

int QTextFormat::objectType ( ) const
inline

Returns the text format's object type.

See also
ObjectTypes, setObjectType()

Definition at line 356 of file qtextformat.h.

Here is the caller graph for this function:

◆ operator QVariant()

QTextFormat::operator QVariant ( ) const

Returns the text format as a QVariant

Definition at line 963 of file qtextformat.cpp.

Here is the call graph for this function:

◆ operator!=()

bool QTextFormat::operator!= ( const QTextFormat other) const
inline

Returns true if this text format is different from the other text format.

Definition at line 376 of file qtextformat.h.

Here is the call graph for this function:

◆ operator=()

QTextFormat & QTextFormat::operator= ( const QTextFormat other)

Assigns the other text format to this text format, and returns a reference to this text format.

Definition at line 937 of file qtextformat.cpp.

◆ operator==()

bool QTextFormat::operator== ( const QTextFormat other) const

Returns true if this text format is the same as the other text format.

Definition at line 1390 of file qtextformat.cpp.

◆ penProperty()

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.

See also
setProperty(), boolProperty(), intProperty(), doubleProperty(), stringProperty(), lengthProperty(), lengthVectorProperty(), Property

Definition at line 1162 of file qtextformat.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ properties()

QMap< int, QVariant > QTextFormat::properties ( ) const

Returns a map with all properties of this text format.

Definition at line 1357 of file qtextformat.cpp.

Here is the call graph for this function:

◆ property()

QVariant QTextFormat::property ( int  propertyId) const

Returns the property specified by the given propertyId.

See also
Property

Definition at line 1234 of file qtextformat.cpp.

Here is the caller graph for this function:

◆ propertyCount()

int QTextFormat::propertyCount ( ) const
Since
4.3 Returns the number of properties stored in the format.

Definition at line 1371 of file qtextformat.cpp.

◆ setBackground()

void QTextFormat::setBackground ( const QBrush brush)
inline

Sets the brush use to paint the document's background to the brush specified.

See also
background(), clearBackground(), setForeground()

Definition at line 384 of file qtextformat.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setForeground()

void QTextFormat::setForeground ( const QBrush brush)
inline

Sets the foreground brush to the specified brush. The foreground brush is mostly used to render text.

See also
foreground(), clearForeground(), setBackground()

Definition at line 391 of file qtextformat.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setLayoutDirection()

void QTextFormat::setLayoutDirection ( Qt::LayoutDirection  direction)
inline

Sets the document's layout direction to the specified direction.

See also
layoutDirection()

Definition at line 379 of file qtextformat.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setObjectIndex()

void QTextFormat::setObjectIndex ( int  index)

Sets the format object's object index.

See also
objectIndex()

Definition at line 1324 of file qtextformat.cpp.

Here is the caller graph for this function:

◆ setObjectType()

void QTextFormat::setObjectType ( int  type)
inline

Sets the text format's object type to type.

See also
ObjectTypes, objectType()

Definition at line 410 of file qtextformat.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setProperty() [1/2]

void QTextFormat::setProperty ( int  propertyId,
const QList< QTextLength > &  value 
)

Sets the value of the property given by propertyId to value.

See also
lengthVectorProperty(), Property

Definition at line 1259 of file qtextformat.cpp.

◆ setProperty() [2/2]

void QTextFormat::setProperty ( int  propertyId,
const QVariant value 
)

Sets the property specified by the propertyId to the given value.

See also
Property

Definition at line 1244 of file qtextformat.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stringProperty()

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.

See also
setProperty(), boolProperty(), intProperty(), doubleProperty(), colorProperty(), lengthProperty(), lengthVectorProperty(), Property

Definition at line 1126 of file qtextformat.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ swap()

void QTextFormat::swap ( QTextFormat other)
inline
Since
5.0

Swaps this text format with other. This function is very fast and never fails.

Definition at line 322 of file qtextformat.h.

Here is the call graph for this function:

◆ toBlockFormat()

QTextBlockFormat QTextFormat::toBlockFormat ( ) const

Returns this format as a block format.

Definition at line 1008 of file qtextformat.cpp.

Here is the caller graph for this function:

◆ toCharFormat()

QTextCharFormat QTextFormat::toCharFormat ( ) const

Returns this format as a character format.

Definition at line 1016 of file qtextformat.cpp.

Here is the caller graph for this function:

◆ toFrameFormat()

QTextFrameFormat QTextFormat::toFrameFormat ( ) const

Returns this format as a frame format.

Definition at line 1040 of file qtextformat.cpp.

Here is the caller graph for this function:

◆ toImageFormat()

QTextImageFormat QTextFormat::toImageFormat ( ) const

Returns this format as an image format.

Definition at line 1048 of file qtextformat.cpp.

Here is the caller graph for this function:

◆ toListFormat()

QTextListFormat QTextFormat::toListFormat ( ) const

Returns this format as a list format.

Definition at line 1024 of file qtextformat.cpp.

Here is the caller graph for this function:

◆ toTableCellFormat()

QTextTableCellFormat QTextFormat::toTableCellFormat ( ) const
Since
4.4

Returns this format as a table cell format.

Definition at line 1058 of file qtextformat.cpp.

◆ toTableFormat()

QTextTableFormat QTextFormat::toTableFormat ( ) const

Returns this format as a table format.

Definition at line 1032 of file qtextformat.cpp.

Here is the caller graph for this function:

◆ type()

int QTextFormat::type ( ) const

Returns the type of this format.

See also
FormatType

Definition at line 1000 of file qtextformat.cpp.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator<<

Q_GUI_EXPORT QDataStream& operator<< ( QDataStream stream,
const QTextFormat fmt 
)
friend

Definition at line 440 of file qtextformat.cpp.

◆ operator>>

Q_GUI_EXPORT QDataStream& operator>> ( QDataStream stream,
QTextFormat fmt 
)
friend

Definition at line 473 of file qtextformat.cpp.

◆ QTextCharFormat

friend class QTextCharFormat
friend

Definition at line 403 of file qtextformat.h.

◆ QTextFormatCollection

friend class QTextFormatCollection
friend

Definition at line 402 of file qtextformat.h.


The documentation for this class was generated from the following files: