![]() |
Qt 4.8
|
The QTextOption class provides a description of general rich text properties. More...
#include <qtextoption.h>
Classes | |
| class | Tab |
| Each tab definition is represented by this struct. More... | |
Public Types | |
| enum | Flag { ShowTabsAndSpaces = 0x1, ShowLineAndParagraphSeparators = 0x2, AddSpaceForLineAndParagraphSeparators = 0x4, SuppressColors = 0x8, IncludeTrailingSpaces = 0x80000000 } |
| enum | TabType { LeftTab, RightTab, CenterTab, DelimiterTab } |
| enum | WrapMode { NoWrap, WordWrap, ManualWrap, WrapAnywhere, WrapAtWordBoundaryOrAnywhere } |
| This enum describes how text is wrapped in a document. More... | |
Public Functions | |
| Qt::Alignment | alignment () const |
| Returns the text alignment defined by the option. More... | |
| Flags | flags () const |
| Returns the flags associated with the option. More... | |
| QTextOption & | operator= (const QTextOption &o) |
| Returns true if the text option is the same as the other text option; otherwise returns false. More... | |
| QTextOption () | |
| Constructs a text option with default properties for text. More... | |
| QTextOption (Qt::Alignment alignment) | |
| Constructs a text option with the given alignment for text. More... | |
| QTextOption (const QTextOption &o) | |
| Construct a copy of the other text option. More... | |
| void | setAlignment (Qt::Alignment alignment) |
| Sets the option's text alignment to the specified alignment. More... | |
| void | setFlags (Flags flags) |
| Sets the flags associated with the option to the given flags. More... | |
| void | setTabArray (QList< qreal > tabStops) |
| Sets the tab positions for the text layout to those specified by tabStops. More... | |
| void | setTabs (QList< Tab > tabStops) |
| Sets the tab positions for the text layout to those specified by tabStops. More... | |
| void | setTabStop (qreal tabStop) |
| Sets the default distance in device units between tab stops to the value specified by tabStop. More... | |
| void | setTextDirection (Qt::LayoutDirection aDirection) |
| Sets the direction of the text layout defined by the option to the given direction. More... | |
| 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). More... | |
| void | setWrapMode (WrapMode wrap) |
| Sets the option's text wrap mode to the given mode. More... | |
| QList< qreal > | tabArray () const |
| Returns a list of tab positions defined for the text layout. More... | |
| QList< Tab > | tabs () const |
| Returns a list of tab positions defined for the text layout. More... | |
| qreal | tabStop () const |
| Returns the distance in device units between tab stops. More... | |
| Qt::LayoutDirection | textDirection () const |
| Returns the direction of the text layout defined by the option. More... | |
| bool | useDesignMetrics () const |
| Returns true if the layout uses design rather than device metrics; otherwise returns false. More... | |
| WrapMode | wrapMode () const |
| Returns the text wrap mode defined by the option. More... | |
| ~QTextOption () | |
| Destroys the text option. More... | |
Properties | |
| uint | align: 8 |
| QTextOptionPrivate * | d |
| uint | design: 1 |
| uint | direction: 2 |
| uint | f |
| qreal | tab |
| uint | unused: 18 |
| uint | wordWrap: 4 |
The QTextOption 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.
Definition at line 59 of file qtextoption.h.
| enum QTextOption::Flag |
| Enumerator | |
|---|---|
| ShowTabsAndSpaces | |
| ShowLineAndParagraphSeparators | |
| AddSpaceForLineAndParagraphSeparators | |
| SuppressColors | |
| IncludeTrailingSpaces | |
Definition at line 112 of file qtextoption.h.
| enum QTextOption::TabType |
This enum holds the different types of tabulator
| Enumerator | |
|---|---|
| LeftTab | |
| RightTab | |
| CenterTab | |
| DelimiterTab | |
Definition at line 62 of file qtextoption.h.
This enum describes how text is wrapped in a document.
| Enumerator | |
|---|---|
| NoWrap | |
| WordWrap | |
| ManualWrap | |
| WrapAnywhere | |
| WrapAtWordBoundaryOrAnywhere | |
Definition at line 102 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 76 of file qtextoption.cpp.
| QTextOption::~QTextOption | ( | ) |
Destroys the text option.
Definition at line 91 of file qtextoption.cpp.
| QTextOption::QTextOption | ( | const QTextOption & | o | ) |
Construct a copy of the other text option.
Definition at line 104 of file qtextoption.cpp.
|
inline |
Returns the text alignment defined by the option.
Definition at line 97 of file qtextoption.h.
Referenced by QTextEngine::alignLine(), QTextEngine::justify(), QTextLine::layout_helper(), QTextDocumentLayoutPrivate::layoutBlock(), QTextDocumentLayoutPrivate::layoutFlow(), qt_format_text(), and QDeclarativeTextEditPrivate::updateDefaultTextOption().
|
inline |
Returns the flags associated with the option.
Definition at line 121 of file qtextoption.h.
Referenced by QTextLine::draw(), QTextEngine::itemize(), QTextLine::layout_helper(), QPlainTextDocumentLayout::layoutBlock(), QTextDocumentLayoutPrivate::layoutBlock(), QTextEngine::leadingSpaceWidth(), qt_format_text(), QTextLine::textLength(), and QTextEngine::validate().
| 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 127 of file qtextoption.cpp.
|
inline |
Sets the option's text alignment to the specified alignment.
Definition at line 148 of file qtextoption.h.
Referenced by QPainter::drawText(), QLabelPrivate::ensureTextLayouted(), QTextDocumentLayoutPrivate::layoutBlock(), qt_format_text(), QDeclarativeTextPrivate::setupTextLayout(), QDeclarativeTextEditPrivate::updateDefaultTextOption(), QDeclarativeTextPrivate::updateSize(), and QCommonStylePrivate::viewItemDrawText().
|
inline |
Sets the flags associated with the option to the given flags.
Definition at line 151 of file qtextoption.h.
Referenced by QDeclarativeTextPrivate::textDocumentImage(), and QLineControl::updateDisplayText().
Sets the tab positions for the text layout to those specified by tabStops.
Definition at line 154 of file qtextoption.cpp.
Referenced by qt_format_text().
Sets the tab positions for the text layout to those specified by tabStops.
Definition at line 177 of file qtextoption.cpp.
Referenced by QTextDocumentLayoutPrivate::layoutBlock().
|
inline |
Sets the default distance in device units between tab stops to the value specified by tabStop.
Definition at line 154 of file qtextoption.h.
Referenced by qt_format_text(), QTextDocumentPrivate::QTextDocumentPrivate(), QPlainTextEdit::setTabStopWidth(), and QTextEdit::setTabStopWidth().
|
inline |
Sets the direction of the text layout defined by the option to the given direction.
Definition at line 99 of file qtextoption.h.
Referenced by QTextDocumentLayoutPrivate::drawListItem(), QPainter::drawText(), QTextDocumentLayoutPrivate::layoutBlock(), qt_format_text(), QLineControl::updateDisplayText(), and QCommonStylePrivate::viewItemDrawText().
|
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 132 of file qtextoption.h.
|
inline |
Sets the option's text wrap mode to the given mode.
Definition at line 109 of file qtextoption.h.
Referenced by QSvgText::draw(), QPlastiqueStyle::drawComplexControl(), QLabelPrivate::ensureTextLayouted(), QTextLine::layout_helper(), QTextDocumentLayoutPrivate::layoutBlock(), QTextDocumentLayoutPrivate::layoutTable(), QBalloonTip::QBalloonTip(), qt_format_text(), QTextDocumentPrivate::QTextDocumentPrivate(), QDeclarativeTextPrivate::setupTextLayout(), QDeclarativeTextEditPrivate::updateDefaultTextOption(), QTextEditPrivate::updateDefaultTextOption(), QPlainTextEditPrivate::updateDefaultTextOption(), QDeclarativeTextPrivate::updateSize(), QMessageBoxPrivate::updateSize(), QCommonStylePrivate::viewItemDrawText(), and QCommonStylePrivate::viewItemSize().
Returns a list of tab positions defined for the text layout.
Definition at line 189 of file qtextoption.cpp.
Referenced by qt_format_text().
| QList< QTextOption::Tab > QTextOption::tabs | ( | ) | const |
Returns a list of tab positions defined for the text layout.
Definition at line 204 of file qtextoption.cpp.
Referenced by QTextEngine::calculateTabWidth(), qt_format_text(), and setTabArray().
|
inline |
Returns the distance in device units between tab stops.
Convenient function for the above method
Definition at line 124 of file qtextoption.h.
Referenced by QTextEngine::calculateTabWidth(), qt_format_text(), QPlainTextEdit::setTabStopWidth(), and QTextEdit::setTabStopWidth().
|
inline |
Returns the direction of the text layout defined by the option.
Definition at line 100 of file qtextoption.h.
Referenced by QTextEngine::isRightToLeft(), QTextEngine::itemize(), qt_format_text(), and QLabelPrivate::textDirection().
|
inline |
Returns true if the layout uses design rather than device metrics; otherwise returns false.
Definition at line 133 of file qtextoption.h.
|
inline |
Returns the text wrap mode defined by the option.
Definition at line 110 of file qtextoption.h.
Referenced by QTextLine::cursorToX(), QTextLine::layout_helper(), QTextDocumentLayoutPrivate::layoutBlock(), QTextDocumentLayoutPrivate::layoutTable(), qt_format_text(), QDeclarativeTextEditPrivate::updateDefaultTextOption(), QTextEditPrivate::updateDefaultTextOption(), and QPlainTextEditPrivate::updateDefaultTextOption().
|
private |
Definition at line 136 of file qtextoption.h.
Referenced by operator=().
|
private |
Definition at line 143 of file qtextoption.h.
Referenced by operator=(), QTextOption(), setTabArray(), setTabs(), tabArray(), tabs(), and ~QTextOption().
|
private |
Definition at line 138 of file qtextoption.h.
Referenced by operator=().
|
private |
Definition at line 139 of file qtextoption.h.
Referenced by operator=(), and QTextOption().
|
private |
Definition at line 141 of file qtextoption.h.
Referenced by operator=().
|
private |
Definition at line 142 of file qtextoption.h.
Referenced by operator=(), and setTabArray().
|
private |
Definition at line 140 of file qtextoption.h.
Referenced by operator=().
|
private |
Definition at line 137 of file qtextoption.h.
Referenced by operator=().