Skip to content

PythonQt.QtGui.QTextFormat

QTextFormat

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

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.

Source: https://doc.qt.io/archives/qt-5.15/qtextformat.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
AnchorHref attribute Any (shared captured text)
AnchorName attribute Any (shared captured text)
BackgroundBrush attribute Any (shared captured text)
BackgroundImageUrl attribute Any (shared captured text)
BlockAlignment attribute Any (shared captured text)
BlockBottomMargin attribute Any (shared captured text)
BlockFormat attribute Any (shared captured text)
BlockIndent attribute Any (shared captured text)
BlockLeftMargin attribute Any (shared captured text)
BlockNonBreakableLines attribute Any (shared captured text)
BlockRightMargin attribute Any (shared captured text)
BlockTopMargin attribute Any (shared captured text)
BlockTrailingHorizontalRulerWidth attribute Any (shared captured text)
CharFormat attribute Any (shared captured text)
CssFloat attribute Any (shared captured text)
FirstFontProperty attribute Any (shared captured text)
FontCapitalization attribute Any (shared captured text)
FontFamily attribute Any (shared captured text)
FontFixedPitch attribute Any (shared captured text)
FontHintingPreference attribute Any (shared captured text)
FontItalic attribute Any (shared captured text)
FontKerning attribute Any (shared captured text)
FontLetterSpacing attribute Any (shared captured text)
FontLetterSpacingType attribute Any (shared captured text)
FontOverline attribute Any (shared captured text)
FontPixelSize attribute Any (shared captured text)
FontPointSize attribute Any (shared captured text)
FontSizeAdjustment attribute Any (shared captured text)
FontSizeIncrement attribute Any (shared captured text)
FontStretch attribute Any (shared captured text)
FontStrikeOut attribute Any (shared captured text)
FontStyleHint attribute Any (shared captured text)
FontStyleStrategy attribute Any (shared captured text)
FontUnderline attribute Any (shared captured text)
FontWeight attribute Any (shared captured text)
FontWordSpacing attribute Any (shared captured text)
ForegroundBrush attribute Any (shared captured text)
FormatType attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
FrameBorder attribute Any (shared captured text)
FrameBorderBrush attribute Any (shared captured text)
FrameBorderStyle attribute Any (shared captured text)
FrameBottomMargin attribute Any (shared captured text)
FrameFormat attribute Any (shared captured text)
FrameHeight attribute Any (shared captured text)
FrameLeftMargin attribute Any (shared captured text)
FrameMargin attribute Any (shared captured text)
FramePadding attribute Any (shared captured text)
FrameRightMargin attribute Any (shared captured text)
FrameTopMargin attribute Any (shared captured text)
FrameWidth attribute Any (shared captured text)
FullWidthSelection attribute Any (shared captured text)
ImageHeight attribute Any (shared captured text)
ImageName attribute Any (shared captured text)
ImageObject attribute Any (shared captured text)
ImageWidth attribute Any (shared captured text)
InvalidFormat attribute Any (shared captured text)
IsAnchor attribute Any (shared captured text)
LastFontProperty attribute Any (shared captured text)
LayoutDirection attribute Any (shared captured text)
LineHeight attribute Any (shared captured text)
LineHeightType attribute Any (shared captured text)
ListFormat attribute Any (shared captured text)
ListIndent attribute Any (shared captured text)
ListNumberPrefix attribute Any (shared captured text)
ListNumberSuffix attribute Any (shared captured text)
ListStyle attribute Any (shared captured text)
NoObject attribute Any (shared captured text)
ObjectIndex attribute Any (shared captured text)
ObjectType attribute Any (shared captured text)
ObjectTypes attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
OutlinePen attribute Any (shared captured text)
PageBreakFlag attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
PageBreakFlags attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
PageBreakPolicy attribute Any (shared captured text)
PageBreak_AlwaysAfter attribute Any (shared captured text)
PageBreak_AlwaysBefore attribute Any (shared captured text)
PageBreak_Auto attribute Any (shared captured text)
Property attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
TabPositions attribute Any (shared captured text)
TableCellBottomPadding attribute Any (shared captured text)
TableCellColumnSpan attribute Any (shared captured text)
TableCellLeftPadding attribute Any (shared captured text)
TableCellObject attribute Any (shared captured text)
TableCellPadding attribute Any (shared captured text)
TableCellRightPadding attribute Any (shared captured text)
TableCellRowSpan attribute Any (shared captured text)
TableCellSpacing attribute Any (shared captured text)
TableCellTopPadding attribute Any (shared captured text)
TableColumnWidthConstraints attribute Any (shared captured text)
TableColumns attribute Any (shared captured text)
TableFormat attribute Any (shared captured text)
TableHeaderRowCount attribute Any (shared captured text)
TableObject attribute Any (shared captured text)
TextIndent attribute Any (shared captured text)
TextOutline attribute Any (shared captured text)
TextToolTip attribute Any (shared captured text)
TextUnderlineColor attribute Any (shared captured text)
TextUnderlineStyle attribute Any (shared captured text)
TextVerticalAlignment attribute Any (shared captured text)
UserFormat attribute Any (shared captured text)
UserObject attribute Any (shared captured text)
UserProperty attribute Any (shared captured text)
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
background function (self) -> Any X.background() -> PythonQt.QtGui.QBrush
boolProperty function (self, propertyId: int) -> bool X.boolProperty(propertyId) -> bool
brushProperty function (self, propertyId: int) -> Any X.brushProperty(propertyId) -> PythonQt.QtGui.QBrush
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
clearBackground function (self) -> None Clears the brush used to paint the document's background.
clearForeground function (self) -> None Clears the brush used to paint the document's foreground.
clearProperty function (self, propertyId: int) -> None Clears the value of the property given by propertyId
colorProperty function (self, propertyId: int) -> Any X.colorProperty(propertyId) -> PythonQt.QtGui.QColor
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
doubleProperty function (self, propertyId: int) -> float X.doubleProperty(propertyId) -> float
foreground function (self) -> Any X.foreground() -> PythonQt.QtGui.QBrush
hasProperty function (self, propertyId: int) -> bool X.hasProperty(propertyId) -> bool
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
intProperty function (self, propertyId: int) -> int X.intProperty(propertyId) -> int
isBlockFormat function (self) -> bool X.isBlockFormat() -> bool
isCharFormat function (self) -> bool X.isCharFormat() -> bool
isEmpty function (self) -> bool X.isEmpty() -> bool
isFrameFormat function (self) -> bool X.isFrameFormat() -> bool
isImageFormat function (self) -> bool X.isImageFormat() -> bool
isListFormat function (self) -> bool X.isListFormat() -> bool
isTableCellFormat function (self) -> bool X.isTableCellFormat() -> bool
isTableFormat function (self) -> bool X.isTableFormat() -> bool
isValid function (self) -> bool X.isValid() -> bool
layoutDirection function (self) -> Any Returns the document's layout direction.
lengthProperty function (self, propertyId: int) -> Any X.lengthProperty(propertyId) -> PythonQt.QtGui.QTextLength
lengthVectorProperty function (self, propertyId: int) -> tuple X.lengthVectorProperty(propertyId) -> tuple
merge function (self, other: Any) -> None Merges the other format with this format; where there are conflicts the other format takes precedence.
objectIndex function (self) -> int X.objectIndex() -> int
objectType function (self) -> int X.objectType() -> int
penProperty function (self, propertyId: int) -> Any X.penProperty(propertyId) -> PythonQt.QtGui.QPen
properties function (self) -> dict X.properties() -> dict
property function (self, propertyId: int) -> Any X.property(propertyId) -> object
propertyCount function (self) -> int X.propertyCount() -> int
readFrom function (self, arg__1: Any) -> Any (shared captured text)
setBackground function (self, brush: Any) -> None Sets the brush use to paint the document's background to the brush specified.
setForeground function (self, brush: Any) -> None Sets the foreground brush to the specified brush.
setLayoutDirection function (self, direction: Any) -> None Sets the document's layout direction to the specified direction.
setObjectIndex function (self, object: int) -> None Sets the format object's object index.
setObjectType function (self, type: int) -> None Sets the text format's object type to type.
setProperty function (self, propertyId: int, value: Any) -> None X.setProperty(propertyId, value)
stringProperty function (self, propertyId: int) -> str X.stringProperty(propertyId) -> str
swap function (self, other: Any) -> None Swaps this text format with other.
toBlockFormat function (self) -> Any X.toBlockFormat() -> PythonQt.QtGui.QTextBlockFormat
toCharFormat function (self) -> Any X.toCharFormat() -> PythonQt.QtGui.QTextCharFormat
toFrameFormat function (self) -> Any X.toFrameFormat() -> PythonQt.QtGui.QTextFrameFormat
toImageFormat function (self) -> Any X.toImageFormat() -> PythonQt.QtGui.QTextImageFormat
toListFormat function (self) -> Any X.toListFormat() -> PythonQt.QtGui.QTextListFormat
toTableCellFormat function (self) -> Any X.toTableCellFormat() -> PythonQt.QtGui.QTextTableCellFormat
toTableFormat function (self) -> Any X.toTableFormat() -> PythonQt.QtGui.QTextTableFormat
type function (self) -> int X.type() -> int
writeTo function (self, arg__1: Any) -> Any (shared captured text)