QTextBlockFormat Class
The QTextBlockFormat class provides formatting information for blocks of text in a QTextDocument. More…
| Header | #include <QTextBlockFormat> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::Gui) |
| Module | Nt GUI C++ Classes |
| Inherits | QTextFormat |
List of all members, including inherited members
Public Functions
| QTextBlockFormat() | |
| void | setAlignment(Qt::Alignment alignment) |
| Qt::Alignment | alignment() const |
| void | setTopMargin(qreal margin) |
| qreal | topMargin() const |
| void | setBottomMargin(qreal margin) |
| qreal | bottomMargin() const |
| void | setLeftMargin(qreal margin) |
| qreal | leftMargin() const |
| void | setRightMargin(qreal margin) |
| qreal | rightMargin() const |
| void | setTextIndent(qreal indent) |
| qreal | textIndent() const |
| void | setIndent(int indent) |
| int | indent() const |
| void | setHeadingLevel(int level) |
| int | headingLevel() 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.