![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\reentrant More...
#include <qtextoption.h>
Classes | |
class | Tab |
Public Types | |
enum | TabType { LeftTab , RightTab , CenterTab , DelimiterTab } |
enum | WrapMode { NoWrap , WordWrap , ManualWrap , WrapAnywhere , WrapAtWordBoundaryOrAnywhere } |
This enum describes how text is wrapped in a document. More... | |
enum | Flag { ShowTabsAndSpaces = 0x1 , ShowLineAndParagraphSeparators = 0x2 , AddSpaceForLineAndParagraphSeparators = 0x4 , SuppressColors = 0x8 , ShowDocumentTerminator = 0x10 , ShowDefaultIgnorables = 0x20 , DisableEmojiParsing = 0x40 , IncludeTrailingSpaces = 0x80000000 } |
\value IncludeTrailingSpaces 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. More... | |
Public Member Functions | |
QTextOption () | |
Constructs a text option with default properties for text. | |
Q_IMPLICIT | QTextOption (Qt::Alignment alignment) |
Constructs a text option with the given alignment for text. | |
~QTextOption () | |
Destroys the text option. | |
QTextOption (const QTextOption &o) | |
Construct a copy of the other text option. | |
QTextOption & | operator= (const QTextOption &o) |
Returns true if the text option is the same as the other text option; otherwise returns false . | |
void | setAlignment (Qt::Alignment alignment) |
Sets the option's text alignment to the specified alignment. | |
Qt::Alignment | alignment () const |
Returns the text alignment defined by the option. | |
void | setTextDirection (Qt::LayoutDirection aDirection) |
Sets the direction of the text layout defined by the option to the given direction. | |
Qt::LayoutDirection | textDirection () const |
Returns the direction of the text layout defined by the option. | |
void | setWrapMode (WrapMode wrap) |
Sets the option's text wrap mode to the given mode. | |
WrapMode | wrapMode () const |
Returns the text wrap mode defined by the option. | |
void | setFlags (Flags flags) |
Sets the flags associated with the option to the given flags. | |
Flags | flags () const |
Returns the flags associated with the option. | |
void | setTabStopDistance (qreal tabStopDistance) |
qreal | tabStopDistance () const |
void | setTabArray (const QList< qreal > &tabStops) |
Sets the tab positions for the text layout to those specified by tabStops. | |
QList< qreal > | tabArray () const |
Returns a list of tab positions defined for the text layout. | |
void | setTabs (const QList< Tab > &tabStops) |
QList< Tab > | tabs () const |
void | setUseDesignMetrics (bool b) |
If enable is true then the layout will use design metrics; otherwise it will use the metrics of the paint device (which is the default behavior). | |
bool | useDesignMetrics () const |
Returns true if the layout uses design rather than device metrics; otherwise returns false . | |
\reentrant
The QTextOption class provides a description of general rich text properties. \inmodule QtGui
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.
Definition at line 17 of file qtextoption.h.
enum QTextOption::Flag |
\value IncludeTrailingSpaces 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.
\value ShowTabsAndSpaces Visualize spaces with little dots, and tabs with little arrows. Non-breaking spaces are shown differently to breaking spaces. \value ShowLineAndParagraphSeparators Visualize line and paragraph separators with appropriate symbol characters. \value [since 5.7] ShowDocumentTerminator Visualize the end of the document with a section sign. \value [since 6.9] ShowDefaultIgnorables Render normally non-visual characters if supported by font. \value AddSpaceForLineAndParagraphSeparators While determining the line-break positions take into account the space added for drawing a separator character. \value SuppressColors Suppress all color changes in the character formats (except the main selection). \value [since 6.9] DisableEmojiParsing By default, Qt will detect emoji sequences in input strings and prioritize using color fonts to display them. This extra step can be disabled by setting the DisableEmojiParsing flag if it is known in advance that it will not be needed.
Enumerator | |
---|---|
ShowTabsAndSpaces | |
ShowLineAndParagraphSeparators | |
AddSpaceForLineAndParagraphSeparators | |
SuppressColors | |
ShowDocumentTerminator | |
ShowDefaultIgnorables | |
DisableEmojiParsing | |
IncludeTrailingSpaces |
Definition at line 70 of file qtextoption.h.
enum QTextOption::TabType |
This enum holds the different types of tabulator
\value LeftTab A left-tab \value RightTab A right-tab \value CenterTab A centered-tab \value DelimiterTab A tab stopping at a certain delimiter-character
Enumerator | |
---|---|
LeftTab | |
RightTab | |
CenterTab | |
DelimiterTab |
Definition at line 20 of file qtextoption.h.
This enum describes how text is wrapped in a document.
\value NoWrap Text is not wrapped at all. \value WordWrap Text is wrapped at word boundaries. \value ManualWrap Same as QTextOption::NoWrap \value WrapAnywhere Text can be wrapped at any point on a line, even if it occurs in the middle of a word. \value WrapAtWordBoundaryOrAnywhere 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.
Enumerator | |
---|---|
NoWrap | |
WordWrap | |
ManualWrap | |
WrapAnywhere | |
WrapAtWordBoundaryOrAnywhere |
Definition at line 60 of file qtextoption.h.
QTextOption::QTextOption | ( | ) |
Constructs a text option with default properties for text.
The text alignment property is set to Qt::AlignLeft. The word wrap property is set to QTextOption::WordWrap. The using of design metrics flag is set to false.
Definition at line 23 of file qtextoption.cpp.
QTextOption::QTextOption | ( | Qt::Alignment | alignment | ) |
Constructs a text option with the given alignment for text.
The word wrap property is set to QTextOption::WordWrap. The using of design metrics flag is set to false.
Definition at line 34 of file qtextoption.cpp.
QTextOption::~QTextOption | ( | ) |
Destroys the text option.
Definition at line 49 of file qtextoption.cpp.
QTextOption::QTextOption | ( | const QTextOption & | o | ) |
Construct a copy of the other text option.
Definition at line 59 of file qtextoption.cpp.
|
inline |
Returns the text alignment defined by the option.
Definition at line 55 of file qtextoption.h.
|
inline |
Returns the flags associated with the option.
Definition at line 82 of file qtextoption.h.
QTextOption & QTextOption::operator= | ( | const QTextOption & | o | ) |
Returns true
if the text option is the same as the other text option; otherwise returns false
.
Definition at line 79 of file qtextoption.cpp.
|
inline |
Sets the option's text alignment to the specified alignment.
Definition at line 109 of file qtextoption.h.
Sets the flags associated with the option to the given flags.
Definition at line 112 of file qtextoption.h.
Sets the tab positions for the text layout to those specified by tabStops.
Definition at line 106 of file qtextoption.cpp.
Definition at line 127 of file qtextoption.cpp.
Sets the default distance in device units between tab stops to the value specified by tabStopDistance.
Definition at line 115 of file qtextoption.h.
|
inline |
Sets the direction of the text layout defined by the option to the given direction.
Definition at line 57 of file qtextoption.h.
|
inline |
If enable is true then the layout will use design metrics; otherwise it will use the metrics of the paint device (which is the default behavior).
Definition at line 93 of file qtextoption.h.
Sets the option's text wrap mode to the given mode.
Definition at line 67 of file qtextoption.h.
Returns a list of tab positions defined for the text layout.
Definition at line 139 of file qtextoption.cpp.
QList< QTextOption::Tab > QTextOption::tabs | ( | ) | const |
Returns a list of tab positions defined for the text layout.
Definition at line 155 of file qtextoption.cpp.
|
inline |
Returns the distance in device units between tab stops.
Definition at line 85 of file qtextoption.h.
|
inline |
Returns the direction of the text layout defined by the option.
Definition at line 58 of file qtextoption.h.
|
inline |
Returns true
if the layout uses design rather than device metrics; otherwise returns false
.
Definition at line 94 of file qtextoption.h.
|
inline |
Returns the text wrap mode defined by the option.
Definition at line 68 of file qtextoption.h.