6.0.0-rc4Source

QTextOption Class

The QTextOption class provides a description of general rich text properties. More…

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

List of all members, including inherited members

Public Types

enumWrapMode

Public Functions

QTextOption()
QTextOption(Qt::Alignment alignment)
voidsetAlignment(Qt::Alignment alignment)
Qt::Alignmentalignment() const
voidsetWrapMode(WrapMode wrap)
WrapModewrapMode() const
voidsetTabStopDistance(qreal tabStopDistance)
qrealtabStopDistance() const

Detailed Description

A text option says how a QTextLayout aligns its lines, how it breaks them, and how wide a tab is.

See also QTextLayout.

Differences from Qt

There are no text directions, flags (such as showing tabs and spaces) or lists of tab stops.

Member Type Documentation

enum QTextOption::WrapMode

How the lines of a text are broken.

ConstantDescription
QTextOption::NoWrapNot at all: a line ends only where the text has a line break.
QTextOption::WordWrapBetween words. A word that is longer than a line sticks out.
QTextOption::ManualWrapThe same as NoWrap.
QTextOption::WrapAnywhereWherever the line is full, also inside a word.
QTextOption::WrapAtWordBoundaryOrAnywhereBetween words, and inside a word only if the word is longer than a line. This is the default.

Member Function Documentation

QTextOption::QTextOption()

Constructs a text option that aligns text to the left and wraps it with WrapAtWordBoundaryOrAnywhere.

QTextOption::QTextOption(Qt::Alignment alignment)

Constructs a text option with the alignment alignment.

Qt::Alignment QTextOption::alignment() const

Returns the alignment of the lines.

See also setAlignment().

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

Sets the alignment of the lines to alignment.

See also alignment().

void QTextOption::setTabStopDistance(qreal tabStopDistance)

Sets the distance between tab stops to tabStopDistance pixels. A distance that is not positive stands for eight spaces of the font, which is the default.

See also tabStopDistance().

void QTextOption::setWrapMode(WrapMode wrap)

Sets how lines are broken to wrap.

See also wrapMode().

qreal QTextOption::tabStopDistance() const

Returns the distance between tab stops, or -1 for eight spaces of the font.

See also setTabStopDistance().

WrapMode QTextOption::wrapMode() const

Returns how lines are broken.

See also setWrapMode().