
We bake cookies in your browser for a better experience. Using this site means that you consent.Read More
TheQTextOption class provides a description of general rich text properties.More...
| Header: | #include <QTextOption> |
Note: All functions in this class arereentrant.
| class | Tab |
| enum | Flag { IncludeTrailingSpaces, ShowTabsAndSpaces, ShowLineAndParagraphSeparators, AddSpaceForLineAndParagraphSeparators, SuppressColors } |
| flags | Flags |
| enum | TabType { LeftTab, RightTab, CenterTab, DelimiterTab } |
| enum | WrapMode { NoWrap, WordWrap, ManualWrap, WrapAnywhere, WrapAtWordBoundaryOrAnywhere } |
| QTextOption() | |
| QTextOption(Qt::Alignment alignment) | |
| QTextOption(const QTextOption & other) | |
| ~QTextOption() | |
| Qt::Alignment | alignment() const |
| Flags | flags() const |
| void | setAlignment(Qt::Alignment alignment) |
| void | setFlags(Flags flags) |
| void | setTabArray(QList<qreal> tabStops) |
| void | setTabStop(qreal tabStop) |
| void | setTabs(QList<Tab> tabStops) |
| void | setTextDirection(Qt::LayoutDirection direction) |
| void | setUseDesignMetrics(bool enable) |
| void | setWrapMode(WrapMode mode) |
| QList<qreal> | tabArray() const |
| qreal | tabStop() const |
| QList<Tab> | tabs() const |
| Qt::LayoutDirection | textDirection() const |
| bool | useDesignMetrics() const |
| WrapMode | wrapMode() const |
| QTextOption & | operator=(const QTextOption & other) |
TheQTextOption class provides a description of general rich text properties.
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 alsoQTextEdit,QTextDocument, andQTextCursor.
| 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. |
QTextOption::ShowLineAndParagraphSeparators | 0x2 | Visualize line and paragraph separators with appropriate symbol characters. |
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). |
The Flags type is a typedef forQFlags<Flag>. It stores an OR combination of Flag values.
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.
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. |
Constructs a text option with default properties for text. The text alignment property is set toQt::AlignLeft. The word wrap property is set toQTextOption::WordWrap. The using of design metrics flag is set to false.
Constructs a text option with the givenalignment for text. The word wrap property is set toQTextOption::WordWrap. The using of design metrics flag is set to false.
Construct a copy of theother text option.
Destroys the text option.
Returns the text alignment defined by the option.
See alsosetAlignment().
Returns the flags associated with the option.
See alsosetFlags().
Sets the option's text alignment to the specifiedalignment.
See alsoalignment().
Sets the flags associated with the option to the givenflags.
See alsoflags().
Sets the tab positions for the text layout to those specified bytabStops.
See alsotabArray(),setTabStop(), andsetTabs().
Sets the default distance in device units between tab stops to the value specified bytabStop.
See alsotabStop(),setTabArray(),setTabs(), andtabs().
Set the Tab properties totabStops.
Sets the direction of the text layout defined by the option to the givendirection.
See alsotextDirection().
Ifenable is true then the layout will use design metrics; otherwise it will use the metrics of the paint device (which is the default behavior).
See alsouseDesignMetrics().
Sets the option's text wrap mode to the givenmode.
See alsowrapMode().
Returns a list of tab positions defined for the text layout.
See alsosetTabArray() andtabStop().
Returns the distance in device units between tab stops. Convenient function for the above method
See alsosetTabStop(),tabArray(),setTabs(), andtabs().
Returns a list of tab positions defined for the text layout.
This function was introduced in Qt 4.4.
See alsotabStop(),setTabs(), andsetTabStop().
Returns the direction of the text layout defined by the option.
See alsosetTextDirection().
Returns true if the layout uses design rather than device metrics; otherwise returns false.
See alsosetUseDesignMetrics().
Returns the text wrap mode defined by the option.
See alsosetWrapMode().
Returns true if the text option is the same as theother text option; otherwise returns false.
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.