6.0.0-rc4Source

QTextBlockFormat Class

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

Header#include <QTextBlockFormat>
CMaketarget_link_libraries(app PRIVATE Nt::Gui)
ModuleNt GUI C++ Classes
InheritsQTextFormat

List of all members, including inherited members

Public Functions

QTextBlockFormat()
voidsetAlignment(Qt::Alignment alignment)
Qt::Alignmentalignment() const
voidsetTopMargin(qreal margin)
qrealtopMargin() const
voidsetBottomMargin(qreal margin)
qrealbottomMargin() const
voidsetLeftMargin(qreal margin)
qrealleftMargin() const
voidsetRightMargin(qreal margin)
qrealrightMargin() const
voidsetTextIndent(qreal indent)
qrealtextIndent() const
voidsetIndent(int indent)
intindent() const
voidsetHeadingLevel(int level)
intheadingLevel() const

Detailed Description

A block is a paragraph. Its format says how its lines are aligned, how much room there is around it, how far it is indented, and whether it is a heading.

See also QTextFormat and QTextDocument.

Differences from Qt

There are no line heights, tab positions, page breaks or markers, and no setting to keep a block on one line.

Member Function Documentation

QTextBlockFormat::QTextBlockFormat()

Constructs a block format without properties.

Qt::Alignment QTextBlockFormat::alignment() const

Returns how the lines of the block are aligned; to the left if nothing is set.

qreal QTextBlockFormat::bottomMargin() const

Returns the space below the block.

int QTextBlockFormat::headingLevel() const

Returns the level of the heading that the block is, or 0.

int QTextBlockFormat::indent() const

Returns the number of steps that the block is indented by.

qreal QTextBlockFormat::leftMargin() const

Returns the space left of the block.

qreal QTextBlockFormat::rightMargin() const

Returns the space right of the block.

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

Sets how the lines of the block are aligned to alignment.

void QTextBlockFormat::setBottomMargin(qreal margin)

Sets the space below the block to margin pixels.

void QTextBlockFormat::setHeadingLevel(int level)

Marks the block as a heading of the level level, 1 to 6, or as an ordinary paragraph with 0.

void QTextBlockFormat::setIndent(int indent)

Sets the number of steps that the block is indented by to indent; a step is 40 pixels.

void QTextBlockFormat::setLeftMargin(qreal margin)

Sets the space left of the block to margin pixels.

void QTextBlockFormat::setRightMargin(qreal margin)

Sets the space right of the block to margin pixels.

void QTextBlockFormat::setTextIndent(qreal indent)

Sets the indentation of the first line of the block to indent pixels.

void QTextBlockFormat::setTopMargin(qreal margin)

Sets the space above the block to margin pixels.

qreal QTextBlockFormat::textIndent() const

Returns the indentation of the first line of the block.

qreal QTextBlockFormat::topMargin() const

Returns the space above the block.