QtBase
v6.3.1
|
The QTextOption class provides a description of general rich text properties. \inmodule QtGui. More...
#include <qtextoption.h>
Classes | |
class | Tab |
Public Types | |
enum | TabType { LeftTab , RightTab , CenterTab , DelimiterTab } |
enum | WrapMode { NoWrap , WordWrap , ManualWrap , WrapAnywhere , WrapAtWordBoundaryOrAnywhere } |
enum | Flag { ShowTabsAndSpaces = 0x1 , ShowLineAndParagraphSeparators = 0x2 , AddSpaceForLineAndParagraphSeparators = 0x4 , SuppressColors = 0x8 , ShowDocumentTerminator = 0x10 , IncludeTrailingSpaces = 0x80000000 } |
Public Member Functions | |
QTextOption () | |
Q_IMPLICIT | QTextOption (Qt::Alignment alignment) |
~QTextOption () | |
QTextOption (const QTextOption &o) | |
QTextOption & | operator= (const QTextOption &o) |
void | setAlignment (Qt::Alignment alignment) |
Qt::Alignment | alignment () const |
void | setTextDirection (Qt::LayoutDirection aDirection) |
Qt::LayoutDirection | textDirection () const |
void | setWrapMode (WrapMode wrap) |
WrapMode | wrapMode () const |
void | setFlags (Flags flags) |
Flags | flags () const |
void | setTabStopDistance (qreal tabStopDistance) |
qreal | tabStopDistance () const |
void | setTabArray (const QList< qreal > &tabStops) |
QList< qreal > | tabArray () const |
void | setTabs (const QList< Tab > &tabStops) |
QList< Tab > | tabs () const |
void | setUseDesignMetrics (bool b) |
bool | useDesignMetrics () const |
The QTextOption class provides a description of general rich text properties. \inmodule QtGui.
\reentrant
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 53 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 ShowDocumentTerminator Visualize the end of the document with a section sign. This enum value was added in Qt 5.7. \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).
Enumerator | |
---|---|
ShowTabsAndSpaces | |
ShowLineAndParagraphSeparators | |
AddSpaceForLineAndParagraphSeparators | |
SuppressColors | |
ShowDocumentTerminator | |
IncludeTrailingSpaces |
Definition at line 106 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 56 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 96 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 59 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 70 of file qtextoption.cpp.
QTextOption::~QTextOption | ( | ) |
Destroys the text option.
Definition at line 85 of file qtextoption.cpp.
QTextOption::QTextOption | ( | const QTextOption & | other | ) |
Construct a copy of the other text option.
Definition at line 95 of file qtextoption.cpp.
|
inline |
Returns the text alignment defined by the option.
Definition at line 91 of file qtextoption.h.
|
inline |
Returns the flags associated with the option.
Definition at line 116 of file qtextoption.h.
QTextOption & QTextOption::operator= | ( | const QTextOption & | other | ) |
Returns true
if the text option is the same as the other text option; otherwise returns false
.
Definition at line 115 of file qtextoption.cpp.
|
inline |
Sets the option's text alignment to the specified alignment.
Definition at line 143 of file qtextoption.h.
Sets the flags associated with the option to the given flags.
Definition at line 146 of file qtextoption.h.
Sets the tab positions for the text layout to those specified by tabStops.
Definition at line 142 of file qtextoption.cpp.
Definition at line 163 of file qtextoption.cpp.
Sets the default distance in device units between tab stops to the value specified by tabStopDistance.
Definition at line 149 of file qtextoption.h.
|
inline |
Sets the direction of the text layout defined by the option to the given direction.
Definition at line 93 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 127 of file qtextoption.h.
Sets the option's text wrap mode to the given mode.
Definition at line 103 of file qtextoption.h.
Returns a list of tab positions defined for the text layout.
Definition at line 175 of file qtextoption.cpp.
QList< QTextOption::Tab > QTextOption::tabs | ( | ) | const |
Returns a list of tab positions defined for the text layout.
Definition at line 191 of file qtextoption.cpp.
|
inline |
Returns the distance in device units between tab stops.
Definition at line 119 of file qtextoption.h.
|
inline |
Returns the direction of the text layout defined by the option.
Definition at line 94 of file qtextoption.h.
|
inline |
Returns true
if the layout uses design rather than device metrics; otherwise returns false
.
Definition at line 128 of file qtextoption.h.
|
inline |
Returns the text wrap mode defined by the option.
Definition at line 104 of file qtextoption.h.