QTextOption Class
The QTextOption class provides a description of general rich text properties. More…
| Header | #include <QTextOption> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::Gui) |
| Module | Nt GUI C++ Classes |
List of all members, including inherited members
Public Types
| enum | WrapMode |
Public Functions
| QTextOption() | |
| QTextOption(Qt::Alignment alignment) | |
| void | setAlignment(Qt::Alignment alignment) |
| Qt::Alignment | alignment() const |
| void | setWrapMode(WrapMode wrap) |
| WrapMode | wrapMode() const |
| void | setTabStopDistance(qreal tabStopDistance) |
| qreal | tabStopDistance() 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.
| Constant | Description |
|---|---|
QTextOption::NoWrap | Not at all: a line ends only where the text has a line break. |
QTextOption::WordWrap | Between words. A word that is longer than a line sticks out. |
QTextOption::ManualWrap | The same as NoWrap. |
QTextOption::WrapAnywhere | Wherever the line is full, also inside a word. |
QTextOption::WrapAtWordBoundaryOrAnywhere | Between 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().