|  | Home · Overviews · Examples

# QTextBlockFormat Class Reference
[com.trolltech.qt.gui module]

The `QTextBlockFormat` class provides formatting information for blocks of text in a `QTextDocument`. More...

Inherits `QTextFormat`.

## Detailed Description

The `QTextBlockFormat` class provides formatting information for blocks of text in a `QTextDocument`.

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 setDirection(). 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 breaking can be enabled and disabled with `setNonBreakableLines`.

The brush used to paint the paragraph's background is set with setBackground(), and other aspects of the text's appearance can be customized by using the setProperty() function with the `OutlinePen`, `ForegroundBrush`, and `BackgroundBrush` `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` and `QTextCharFormat`.