Qt 4.8
|
The QDeclarativeTextLayout class is a version of QStaticText that works with QTextLayouts. More...
#include <qdeclarativetextlayout_p.h>
Public Functions | |
void | beginLayout () |
void | clearLayout () |
void | draw (QPainter *, const QPointF &=QPointF()) |
void | prepare () |
QDeclarativeTextLayout () | |
QDeclarativeTextLayout (const QString &) | |
~QDeclarativeTextLayout () | |
Public Functions inherited from QTextLayout | |
QList< FormatRange > | additionalFormats () const |
Returns the list of additional formats supported by the text layout. More... | |
void | beginLayout () |
Begins the layout process. More... | |
QRectF | boundingRect () const |
The smallest rectangle that contains all the lines in the layout. More... | |
bool | cacheEnabled () const |
Returns true if the complete layout information is cached; otherwise returns false. More... | |
void | clearAdditionalFormats () |
Clears the list of additional formats supported by the text layout. More... | |
void | clearLayout () |
Clears the line information in the layout. More... | |
QTextLine | createLine () |
Returns a new text line to be laid out if there is text to be inserted into the layout; otherwise returns an invalid text line. More... | |
Qt::CursorMoveStyle | cursorMoveStyle () const |
The cursor movement style of this QTextLayout. More... | |
void | draw (QPainter *p, const QPointF &pos, const QVector< FormatRange > &selections=QVector< FormatRange >(), const QRectF &clip=QRectF()) const |
Draws the whole layout on the painter p at the position specified by pos. More... | |
void | drawCursor (QPainter *p, const QPointF &pos, int cursorPosition) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws a text cursor with the current pen at the given position using the painter specified. More... | |
void | drawCursor (QPainter *p, const QPointF &pos, int cursorPosition, int width) const |
Draws a text cursor with the current pen and the specified width at the given position using the painter specified. More... | |
void | endLayout () |
Ends the layout process. More... | |
QTextEngine * | engine () const |
QFont | font () const |
Returns the current font that is used for the layout, or a default font if none is set. More... | |
QList< QGlyphRun > | glyphRuns () const |
Returns the glyph indexes and positions for all glyphs in this QTextLayout. More... | |
bool | isValidCursorPosition (int pos) const |
/ Returns true if position pos is a valid cursor position. More... | |
int | leftCursorPosition (int oldPos) const |
Returns the cursor position to the left of oldPos, next to it. More... | |
QTextLine | lineAt (int i) const |
Returns the {i}-th line of text in this text layout. More... | |
int | lineCount () const |
Returns the number of lines in this text layout. More... | |
QTextLine | lineForTextPosition (int pos) const |
Returns the line that contains the cursor position specified by pos. More... | |
qreal | maximumWidth () const |
The maximum width the layout could expand to; this is essentially the width of the entire text. More... | |
qreal | minimumWidth () const |
The minimum width the layout needs. More... | |
int | nextCursorPosition (int oldPos, CursorMode mode=SkipCharacters) const |
Returns the next valid cursor position after oldPos that respects the given cursor mode. More... | |
QPointF | position () const |
The global position of the layout. More... | |
int | preeditAreaPosition () const |
Returns the position of the area in the text layout that will be processed before editing occurs. More... | |
QString | preeditAreaText () const |
Returns the text that is inserted in the layout before editing occurs. More... | |
int | previousCursorPosition (int oldPos, CursorMode mode=SkipCharacters) const |
Returns the first valid cursor position before oldPos that respects the given cursor mode. More... | |
QTextLayout () | |
Constructs an empty text layout. More... | |
QTextLayout (const QString &text) | |
Constructs a text layout to lay out the given text. More... | |
QTextLayout (const QString &text, const QFont &font, QPaintDevice *paintdevice=0) | |
Constructs a text layout to lay out the given text with the specified font. More... | |
QTextLayout (const QTextBlock &b) | |
Constructs a text layout to lay out the given block. More... | |
int | rightCursorPosition (int oldPos) const |
Returns the cursor position to the right of oldPos, next to it. More... | |
void | setAdditionalFormats (const QList< FormatRange > &overrides) |
Sets the additional formats supported by the text layout to formatList. More... | |
void | setCacheEnabled (bool enable) |
Enables caching of the complete layout information if enable is true; otherwise disables layout caching. More... | |
void | setCursorMoveStyle (Qt::CursorMoveStyle style) |
Set the cursor movement style. More... | |
void | setFlags (int flags) |
void | setFont (const QFont &f) |
Sets the layout's font to the given font. More... | |
void | setPosition (const QPointF &p) |
Moves the text layout to point p. More... | |
void | setPreeditArea (int position, const QString &text) |
Sets the position and text of the area in the layout that is processed before editing occurs. More... | |
void | setText (const QString &string) |
Sets the layout's text to the given string. More... | |
void | setTextOption (const QTextOption &option) |
Sets the text option structure that controls the layout process to the given option. More... | |
QString | text () const |
Returns the layout's text. More... | |
QTextOption | textOption () const |
Returns the current text option used to control the layout process. More... | |
~QTextLayout () | |
Destructs the layout. More... | |
Properties | |
QDeclarativeTextLayoutPrivate * | d |
Additional Inherited Members | |
Public Types inherited from QTextLayout | |
enum | CursorMode { SkipCharacters, SkipWords } |
The QDeclarativeTextLayout class is a version of QStaticText that works with QTextLayouts.
This class is basically a copy of the QStaticText code, but it is adapted to source its text from QTextLayout.
It is also considerably faster to create a QDeclarativeTextLayout than a QStaticText because it uses a single, shared QPainter instance. QStaticText by comparison creates a new QPainter per instance. As a consequence this means that QDeclarativeTextLayout is not re-enterant. Adding a lock around the shared painter solves this, and only introduces a minor performance penalty, but is unnecessary for QDeclarativeTextLayout's current use (QDeclarativeText is already tied to the GUI thread).
Definition at line 54 of file qdeclarativetextlayout_p.h.
QDeclarativeTextLayout::QDeclarativeTextLayout | ( | ) |
Definition at line 268 of file qdeclarativetextlayout.cpp.
QDeclarativeTextLayout::QDeclarativeTextLayout | ( | const QString & | text | ) |
Definition at line 273 of file qdeclarativetextlayout.cpp.
QDeclarativeTextLayout::~QDeclarativeTextLayout | ( | ) |
Definition at line 278 of file qdeclarativetextlayout.cpp.
void QDeclarativeTextLayout::beginLayout | ( | ) |
Definition at line 283 of file qdeclarativetextlayout.cpp.
void QDeclarativeTextLayout::clearLayout | ( | ) |
Definition at line 296 of file qdeclarativetextlayout.cpp.
Definition at line 342 of file qdeclarativetextlayout.cpp.
void QDeclarativeTextLayout::prepare | ( | ) |
Definition at line 309 of file qdeclarativetextlayout.cpp.
Referenced by draw().
|
private |
Definition at line 68 of file qdeclarativetextlayout_p.h.
Referenced by beginLayout(), clearLayout(), draw(), prepare(), and ~QDeclarativeTextLayout().