QTextOption Class
The QTextOption class provides a description of general rich text properties. More...
| Header: | #include <QTextOption> |
| qmake: | QT += gui |
Note: All functions in this class are reentrant.
Public Types
| struct | Tab |
| enum | Flag { IncludeTrailingSpaces, ShowTabsAndSpaces, ShowLineAndParagraphSeparators, ShowDocumentTerminator, AddSpaceForLineAndParagraphSeparators, SuppressColors } |
| enum | TabType { LeftTab, RightTab, CenterTab, DelimiterTab } |
| enum | WrapMode { NoWrap, WordWrap, ManualWrap, WrapAnywhere, WrapAtWordBoundaryOrAnywhere } |
Detailed Description
QTextOption is used to encapsulate common rich text properties in a single object. It contains information about text alignment, layout direction, word wrapping, and other standard properties associated with text rendering and layout.
See also QTextEdit, QTextDocument, and QTextCursor.
Member Type Documentation
enum QTextOption::Flag
| Constant | Value | Description |
|---|---|---|
QTextOption::IncludeTrailingSpaces | 0x80000000 | When this option is set, QTextLine::naturalTextWidth() and naturalTextRect() will return a value that includes the width of trailing spaces in the text; otherwise this width is excluded. |
QTextOption::ShowTabsAndSpaces | 0x1 | Visualize spaces with little dots, and tabs with little arrows. Non-breaking spaces are shown differently to breaking spaces. |
QTextOption::ShowLineAndParagraphSeparators | 0x2 | Visualize line and paragraph separators with appropriate symbol characters. |
QTextOption::ShowDocumentTerminator | 0x10 | Visualize the end of the document with a section sign. This enum value was added in Qt 5.7. |
QTextOption::AddSpaceForLineAndParagraphSeparators | 0x4 | While determining the line-break positions take into account the space added for drawing a separator character. |
QTextOption::SuppressColors | 0x8 | Suppress all color changes in the character formats (except the main selection). |
enum QTextOption::TabType
This enum holds the different types of tabulator
| Constant | Value | Description |
|---|---|---|
QTextOption::LeftTab | 0 | A left-tab |
QTextOption::RightTab | 1 | A right-tab |
QTextOption::CenterTab | 2 | A centered-tab |
QTextOption::DelimiterTab | 3 | A tab stopping at a certain delimiter-character |
This enum was introduced or modified in Qt 4.4.
enum QTextOption::WrapMode
This enum describes how text is wrapped in a document.
| Constant | Value | Description |
|---|---|---|
QTextOption::NoWrap | 0 | Text is not wrapped at all. |
QTextOption::WordWrap | 1 | Text is wrapped at word boundaries. |
QTextOption::ManualWrap | 2 | Same as QTextOption::NoWrap |
QTextOption::WrapAnywhere | 3 | Text can be wrapped at any point on a line, even if it occurs in the middle of a word. |
QTextOption::WrapAtWordBoundaryOrAnywhere | 4 | If possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word. |