Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QTextBlockFormat Class Reference

\reentrant More...

#include <qtextformat.h>

+ Inheritance diagram for QTextBlockFormat:
+ Collaboration diagram for QTextBlockFormat:

Public Types

enum  LineHeightTypes {
  SingleHeight = 0 , ProportionalHeight = 1 , FixedHeight = 2 , MinimumHeight = 3 ,
  LineDistanceHeight = 4
}
 
enum class  MarkerType { NoMarker = 0 , Unchecked = 1 , Checked = 2 }
 
- Public Types inherited from QTextFormat
enum  FormatType {
  InvalidFormat = -1 , BlockFormat = 1 , CharFormat = 2 , ListFormat = 3 ,
  FrameFormat = 5 , UserFormat = 100
}
 This enum describes the text item a QTextFormat object is formatting. More...
 
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 , OldFontFamily = 0x2000 , ObjectType = 0x2f00 , ListStyle = 0x3000 ,
  ListIndent = 0x3001 , ListNumberPrefix = 0x3002 , ListNumberSuffix = 0x3003 , ListStart = 0x3004 ,
  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
}
 This enum describes the different properties a format can have. More...
 
enum  ObjectTypes {
  NoObject , ImageObject , TableObject , TableCellObject ,
  UserObject = 0x1000
}
 This enum describes what kind of QTextObject this format is associated with. More...
 
enum  PageBreakFlag { PageBreak_Auto = 0 , PageBreak_AlwaysBefore = 0x001 , PageBreak_AlwaysAfter = 0x010 }
 

Public Member Functions

 QTextBlockFormat ()
 Constructs a new QTextBlockFormat.
 
bool isValid () const
 Returns true if this block format is valid; otherwise returns false.
 
void setAlignment (Qt::Alignment alignment)
 Sets the paragraph's alignment.
 
Qt::Alignment alignment () const
 Returns the paragraph's alignment.
 
void setTopMargin (qreal margin)
 Sets the paragraph's top margin.
 
qreal topMargin () const
 Returns the paragraph's top margin.
 
void setBottomMargin (qreal margin)
 Sets the paragraph's bottom margin.
 
qreal bottomMargin () const
 Returns the paragraph's bottom margin.
 
void setLeftMargin (qreal margin)
 Sets the paragraph's left margin.
 
qreal leftMargin () const
 Returns the paragraph's left margin.
 
void setRightMargin (qreal margin)
 Sets the paragraph's right margin.
 
qreal rightMargin () const
 Returns the paragraph's right margin.
 
void setTextIndent (qreal aindent)
 Sets the indent for the first line in the block.
 
qreal textIndent () const
 Returns the paragraph's text indent.
 
void setIndent (int indent)
 Sets the paragraph's indentation.
 
int indent () const
 Returns the paragraph's indent.
 
void setHeadingLevel (int alevel)
 
int headingLevel () const
 
void setLineHeight (qreal height, int heightType)
 
qreal lineHeight (qreal scriptLineHeight, qreal scaling) const
 
qreal lineHeight () const
 
int lineHeightType () const
 
void setNonBreakableLines (bool b)
 If b is true, the lines in the paragraph are treated as non-breakable; otherwise they are breakable.
 
bool nonBreakableLines () const
 Returns true if the lines in the paragraph are non-breakable; otherwise returns false.
 
void setPageBreakPolicy (PageBreakFlags flags)
 
PageBreakFlags pageBreakPolicy () const
 
void setTabPositions (const QList< QTextOption::Tab > &tabs)
 
QList< QTextOption::TabtabPositions () const
 
void setMarker (MarkerType marker)
 
MarkerType marker () const
 
- Public Member Functions inherited from QTextFormat
 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.
 
QTextFormatoperator= (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< QTextLengthlengthVectorProperty (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, QVariantproperties () 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.
 

Protected Member Functions

 QTextBlockFormat (const QTextFormat &fmt)
 

Friends

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

Detailed Description

\reentrant

The QTextBlockFormat class provides formatting information for blocks of text in a QTextDocument. \inmodule QtGui

A document is composed of a list of blocks, represented by QTextBlock objects. Each block can contain an item of some kind, such as a paragraph of text, a table, a list, or an image. Every block has an associated QTextBlockFormat that specifies its characteristics.

To cater for left-to-right and right-to-left languages you can set a block's direction with setLayoutDirection(). Paragraph alignment is set with setAlignment(). Margins are controlled by setTopMargin(), setBottomMargin(), setLeftMargin(), setRightMargin(). Overall indentation is set with setIndent(), the indentation of the first line with setTextIndent().

Line spacing is set with setLineHeight() and retrieved via lineHeight() and lineHeightType(). The types of line spacing available are in the LineHeightTypes enum.

Line breaking can be enabled and disabled with setNonBreakableLines().

The brush used to paint the paragraph's background is set with \l{QTextFormat::setBackground()}{setBackground()}, and other aspects of the text's appearance can be customized by using the \l{QTextFormat::setProperty()}{setProperty()} function with the OutlinePen, ForegroundBrush, and BackgroundBrush \l{QTextFormat::Property} values.

If a text block is part of a list, it can also have a list format that is accessible with the listFormat() function.

See also
QTextBlock, QTextCharFormat

Definition at line 605 of file qtextformat.h.

Member Enumeration Documentation

◆ LineHeightTypes

Since
4.8

This enum describes the various types of line spacing support paragraphs can have.

\value SingleHeight This is the default line height: single spacing. \value ProportionalHeight This sets the spacing proportional to the line (in percentage). For example, set to 200 for double spacing. \value FixedHeight This sets the line height to a fixed line height (in pixels). \value MinimumHeight This sets the minimum line height (in pixels). \value LineDistanceHeight This adds the specified height between lines (in pixels).

See also
lineHeight(), lineHeightType(), setLineHeight()
Enumerator
SingleHeight 
ProportionalHeight 
FixedHeight 
MinimumHeight 
LineDistanceHeight 

Definition at line 608 of file qtextformat.h.

◆ MarkerType

enum class QTextBlockFormat::MarkerType
strong
Since
5.14

This enum describes the types of markers a list item can have. If a list item (a paragraph for which \l QTextBlock::textList() returns the list) has a marker, it is rendered instead of the normal bullet. In this way, checkable list items can be mixed with plain list items in the same list, overriding the type of bullet specified by the \l QTextListFormat::style() for the entire list.

\value NoMarker This is the default: the list item's bullet will be shown. \value Unchecked Instead of the list item's bullet, an unchecked checkbox will be shown. \value Checked Instead of the list item's bullet, a checked checkbox will be shown.

In the future, this may be extended to specify other types of paragraph decorations.

See also
QTextListFormat::style()
Enumerator
NoMarker 
Unchecked 
Checked 

Definition at line 616 of file qtextformat.h.

Constructor & Destructor Documentation

◆ QTextBlockFormat() [1/2]

QTextBlockFormat::QTextBlockFormat ( )

Constructs a new QTextBlockFormat.

Definition at line 2220 of file qtextformat.cpp.

◆ QTextBlockFormat() [2/2]

QTextBlockFormat::QTextBlockFormat ( const QTextFormat & other)
explicitprotected

Creates a new block format with the same attributes as the given text format.

Definition at line 2229 of file qtextformat.cpp.

Member Function Documentation

◆ alignment()

Qt::Alignment QTextBlockFormat::alignment ( ) const
inline

Returns the paragraph's alignment.

See also
setAlignment()

Definition at line 627 of file qtextformat.h.

References Qt::AlignLeft.

Referenced by QQuickTextSelection::alignment(), QTextHtmlParser::applyAttributes(), and QTextDocumentLayoutPrivate::layoutBlock().

+ Here is the caller graph for this function:

◆ bottomMargin()

qreal QTextBlockFormat::bottomMargin ( ) const
inline

Returns the paragraph's bottom margin.

See also
setBottomMargin(), topMargin()

Definition at line 637 of file qtextformat.h.

Referenced by QTextDocumentLayoutPrivate::layoutFlow().

+ Here is the caller graph for this function:

◆ headingLevel()

int QTextBlockFormat::headingLevel ( ) const
inline
Since
5.12

Returns the paragraph's heading level if it is a heading, or 0 if not.

See also
setHeadingLevel()

Definition at line 661 of file qtextformat.h.

◆ indent()

int QTextBlockFormat::indent ( ) const
inline

Returns the paragraph's indent.

See also
setIndent()

Definition at line 656 of file qtextformat.h.

Referenced by QTextDocumentLayoutPrivate::blockIndent().

+ Here is the caller graph for this function:

◆ isValid()

QTextBlockFormat::isValid ( ) const
inline

Returns true if this block format is valid; otherwise returns false.

Definition at line 624 of file qtextformat.h.

◆ leftMargin()

qreal QTextBlockFormat::leftMargin ( ) const
inline

Returns the paragraph's left margin.

See also
setLeftMargin(), rightMargin(), indent()

Definition at line 642 of file qtextformat.h.

Referenced by QTextDocumentLayoutPrivate::layoutBlock().

+ Here is the caller graph for this function:

◆ lineHeight() [1/2]

qreal QTextBlockFormat::lineHeight ( ) const
inline
Since
4.8

This returns the LineHeight property for the paragraph.

See also
LineHeightTypes, setLineHeight(), lineHeightType()

Definition at line 667 of file qtextformat.h.

◆ lineHeight() [2/2]

qreal QTextBlockFormat::lineHeight ( qreal scriptLineHeight,
qreal scaling = 1.0 ) const
inline
Since
4.8

Returns the height of the lines in the paragraph based on the height of the script line given by scriptLineHeight and the specified scaling factor.

The value that is returned is also dependent on the given LineHeightType of the paragraph as well as the LineHeight setting that has been set for the paragraph.

The scaling is needed for heights that include a fixed number of pixels, to scale them appropriately for printing.

See also
LineHeightTypes, setLineHeight(), lineHeightType()

Definition at line 705 of file qtextformat.h.

References QTextFormat::doubleProperty(), FixedHeight, QTextFormat::intProperty(), LineDistanceHeight, QTextFormat::LineHeight, QTextFormat::LineHeightType, MinimumHeight, ProportionalHeight, qMax(), and SingleHeight.

Referenced by getLineHeightParams().

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

◆ lineHeightType()

qreal QTextBlockFormat::lineHeightType ( ) const
inline
Since
4.8

This returns the LineHeightType property of the paragraph.

See also
LineHeightTypes, setLineHeight(), lineHeight()

Definition at line 669 of file qtextformat.h.

Referenced by getLineHeightParams().

+ Here is the caller graph for this function:

◆ marker()

MarkerType QTextBlockFormat::marker ( ) const
inline
Since
5.14

Returns the paragraph's marker if one has been set, or NoMarker if not.

See also
setMarker()

Definition at line 687 of file qtextformat.h.

Referenced by QQuickTextNodeEngine::addTextBlock(), QAbstractTextDocumentLayout::blockWithMarkerAt(), QTextEditPrivate::hoveredBlockWithMarkerChanged(), and QQuickTextControlPrivate::hoverEvent().

+ Here is the caller graph for this function:

◆ nonBreakableLines()

bool QTextBlockFormat::nonBreakableLines ( ) const
inline

Returns true if the lines in the paragraph are non-breakable; otherwise returns false.

See also
setNonBreakableLines()

Definition at line 674 of file qtextformat.h.

Referenced by QTextDocumentLayoutPrivate::layoutBlock().

+ Here is the caller graph for this function:

◆ pageBreakPolicy()

QTextFormat::PageBreakFlags QTextBlockFormat::pageBreakPolicy ( ) const
inline
Since
4.2

Returns the currently set page break policy for the paragraph. The default is QTextFormat::PageBreak_Auto.

See also
setPageBreakPolicy()

Definition at line 679 of file qtextformat.h.

Referenced by QTextHtmlImporter::import(), and QTextDocumentLayoutPrivate::layoutFlow().

+ Here is the caller graph for this function:

◆ rightMargin()

qreal QTextBlockFormat::rightMargin ( ) const
inline

Returns the paragraph's right margin.

See also
setRightMargin(), leftMargin()

Definition at line 647 of file qtextformat.h.

Referenced by QTextDocumentLayoutPrivate::layoutBlock().

+ Here is the caller graph for this function:

◆ setAlignment()

void QTextBlockFormat::setAlignment ( Qt::Alignment alignment)
inline

Sets the paragraph's alignment.

See also
alignment()

Definition at line 699 of file qtextformat.h.

References QTextFormat::BlockAlignment, and setProperty.

Referenced by QTextHtmlParser::applyAttributes(), QTextMarkdownImporter::cbEnterBlock(), QSplashScreen::drawContents(), QTextHtmlParserNode::initializeProperties(), main(), main_textblock_formats(), QTextEdit::setAlignment(), and QQuickTextSelection::setAlignment().

+ Here is the caller graph for this function:

◆ setBottomMargin()

void QTextBlockFormat::setBottomMargin ( qreal margin)
inline

Sets the paragraph's bottom margin.

See also
bottomMargin(), setTopMargin(), setLeftMargin(), setRightMargin()

Definition at line 635 of file qtextformat.h.

References setProperty.

Referenced by main_textblock_formats().

+ Here is the caller graph for this function:

◆ setHeadingLevel()

void QTextBlockFormat::setHeadingLevel ( int level)
inline
Since
5.12

Sets the paragraph's heading level, where 1 is the highest-level heading type (usually with the largest possible heading font size), and increasing values are progressively deeper into the document (and usually with smaller font sizes). For example when reading an HTML H1 tag, the heading level is set to 1. Setting the heading level does not automatically change the font size; however QTextDocumentFragment::fromHtml() sets both the heading level and the font size simultaneously.

If the paragraph is not a heading, the level should be set to 0 (the default).

See also
headingLevel()

Definition at line 659 of file qtextformat.h.

References setProperty.

◆ setIndent()

void QTextBlockFormat::setIndent ( int indentation)
inline

Sets the paragraph's indentation.

Margins are set independently of indentation with setLeftMargin() and setTextIndent(). The indentation is an integer that is multiplied with the document-wide standard indent, resulting in the actual indent of the paragraph.

See also
indent(), QTextDocument::indentWidth()

Definition at line 702 of file qtextformat.h.

References QTextFormat::BlockIndent, and setProperty.

Referenced by QTextMarkdownImporter::cbText(), QTextHtmlImporter::import(), QWidgetTextControlPrivate::indent(), QWidgetTextControlPrivate::outdent(), and QTextList::remove().

+ Here is the caller graph for this function:

◆ setLeftMargin()

void QTextBlockFormat::setLeftMargin ( qreal margin)
inline

Sets the paragraph's left margin.

Indentation can be applied separately with setIndent().

See also
leftMargin(), setRightMargin(), setTopMargin(), setBottomMargin()

Definition at line 640 of file qtextformat.h.

References setProperty.

Referenced by main_textblock_formats().

+ Here is the caller graph for this function:

◆ setLineHeight()

void QTextBlockFormat::setLineHeight ( qreal height,
int heightType )
inline
Since
4.8

Sets the line height for the paragraph to the value given by height which is dependent on heightType in the way described by the LineHeightTypes enum.

See also
LineHeightTypes, lineHeight(), lineHeightType()

Definition at line 664 of file qtextformat.h.

References setProperty.

Referenced by QQuickTextPrivate::updateLayout().

+ Here is the caller graph for this function:

◆ setMarker()

void QTextBlockFormat::setMarker ( MarkerType marker)
inline
Since
5.14

Sets the type of adornment that should be rendered alongside the paragraph to marker. For example, a list item can be adorned with a checkbox, either checked or unchecked, as a replacement for its bullet. The default is NoMarker.

See also
marker()

Definition at line 685 of file qtextformat.h.

References setProperty.

Referenced by QTextHtmlParser::applyAttributes(), QWidgetTextControlPrivate::mouseReleaseEvent(), and QQuickTextControlPrivate::mouseReleaseEvent().

+ Here is the caller graph for this function:

◆ setNonBreakableLines()

void QTextBlockFormat::setNonBreakableLines ( bool b)
inline

If b is true, the lines in the paragraph are treated as non-breakable; otherwise they are breakable.

See also
nonBreakableLines()

Definition at line 672 of file qtextformat.h.

References setProperty.

◆ setPageBreakPolicy()

void QTextBlockFormat::setPageBreakPolicy ( PageBreakFlags policy)
inline
Since
4.2

Sets the page break policy for the paragraph to policy.

See also
pageBreakPolicy()

Definition at line 677 of file qtextformat.h.

References setProperty.

Referenced by QTextHtmlImporter::import().

+ Here is the caller graph for this function:

◆ setRightMargin()

void QTextBlockFormat::setRightMargin ( qreal margin)
inline

Sets the paragraph's right margin.

See also
rightMargin(), setLeftMargin(), setTopMargin(), setBottomMargin()

Definition at line 645 of file qtextformat.h.

References setProperty.

Referenced by main_textblock_formats().

+ Here is the caller graph for this function:

◆ setTabPositions()

void QTextBlockFormat::setTabPositions ( const QList< QTextOption::Tab > & tabs)
Since
4.4 Sets the tab positions for the text block to those specified by tabs.
See also
tabPositions()

Definition at line 2241 of file qtextformat.cpp.

References QList< T >::append(), QVariant::fromValue(), list, QList< T >::reserve(), setProperty, and QTextFormat::TabPositions.

+ Here is the call graph for this function:

◆ setTextIndent()

void QTextBlockFormat::setTextIndent ( qreal indent)
inline

Sets the indent for the first line in the block.

This allows the first line of a paragraph to be indented differently to the other lines, enhancing the readability of the text.

See also
textIndent(), setLeftMargin(), setRightMargin(), setTopMargin(), setBottomMargin()

Definition at line 650 of file qtextformat.h.

References setProperty.

◆ setTopMargin()

void QTextBlockFormat::setTopMargin ( qreal margin)
inline

Sets the paragraph's top margin.

See also
topMargin(), setBottomMargin(), setLeftMargin(), setRightMargin()

Definition at line 630 of file qtextformat.h.

References setProperty.

Referenced by main_textblock_formats().

+ Here is the caller graph for this function:

◆ tabPositions()

QList< QTextOption::Tab > QTextBlockFormat::tabPositions ( ) const
Since
4.4 Returns a list of tab positions defined for the text block.
See also
setTabPositions()

Definition at line 2256 of file qtextformat.cpp.

References QVariant::isNull(), property, QTextFormat::TabPositions, and variant.

Referenced by QTextDocumentLayoutPrivate::layoutBlock().

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

◆ textIndent()

qreal QTextBlockFormat::textIndent ( ) const
inline

Returns the paragraph's text indent.

See also
setTextIndent()

Definition at line 652 of file qtextformat.h.

Referenced by QTextDocumentLayoutPrivate::layoutBlock().

+ Here is the caller graph for this function:

◆ topMargin()

qreal QTextBlockFormat::topMargin ( ) const
inline

Returns the paragraph's top margin.

See also
setTopMargin(), bottomMargin()

Definition at line 632 of file qtextformat.h.

Referenced by QTextDocumentLayoutPrivate::layoutBlock(), and QTextDocumentLayoutPrivate::layoutFlow().

+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ operator<<

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

Definition at line 474 of file qtextformat.cpp.

◆ operator>>

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

Definition at line 479 of file qtextformat.cpp.

◆ QTextFormat

friend class QTextFormat
friend

Definition at line 692 of file qtextformat.h.


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