diff options
Diffstat (limited to 'src/gui/text/qtextlayout.cpp')
-rw-r--r-- | src/gui/text/qtextlayout.cpp | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index ddf9411..dbfe23e 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -282,12 +282,11 @@ Qt::LayoutDirection QTextInlineObject::textDirection() const \class QTextLayout \reentrant - \brief The QTextLayout class is used to lay out and paint a single - paragraph of text. + \brief The QTextLayout class is used to lay out and render text. \ingroup richtext-processing - It offers most features expected from a modern text layout + It offers many features expected from a modern text layout engine, including Unicode compliant rendering, line breaking and handling of cursor positioning. It can also produce and render device independent layout, something that is important for WYSIWYG @@ -297,29 +296,33 @@ Qt::LayoutDirection QTextInlineObject::textDirection() const implement your own text rendering for some specialized widget, you probably won't need to use it directly. - QTextLayout can currently deal with plain text and rich text - paragraphs that are part of a QTextDocument. + QTextLayout can be used with both plain and rich text. - QTextLayout can be used to create a sequence of QTextLine's with - given widths and can position them independently on the screen. - Once the layout is done, these lines can be drawn on a paint - device. + QTextLayout can be used to create a sequence of QTextLine + instances with given widths and can position them independently + on the screen. Once the layout is done, these lines can be drawn + on a paint device. - Here's some code snippet that presents the layout phase: + The text to be laid out can be provided in the constructor or set with + setText(). + + The layout can be seen as a sequence of QTextLine objects; use createLine() + to create a QTextLine instance, and lineAt() or lineForTextPosition() to retrieve + created lines. + + Here is a code snippet that demonstrates the layout phase: \snippet doc/src/snippets/code/src_gui_text_qtextlayout.cpp 0 - The text can be drawn by calling the layout's draw() function: + The text can then be rendered by calling the layout's draw() function: \snippet doc/src/snippets/code/src_gui_text_qtextlayout.cpp 1 - The text layout's text is set in the constructor or with - setText(). The layout can be seen as a sequence of QTextLine - objects; use lineAt() or lineForTextPosition() to get a QTextLine, - createLine() to create one. For a given position in the text you - can find a valid cursor position with isValidCursorPosition(), - nextCursorPosition(), and previousCursorPosition(). The layout - itself can be positioned with setPosition(); it has a - boundingRect(), and a minimumWidth() and a maximumWidth(). A text - layout can be drawn on a painter device using draw(). + For a given position in the text you can find a valid cursor position with + isValidCursorPosition(), nextCursorPosition(), and previousCursorPosition(). + + The QTextLayout itself can be positioned with setPosition(); it has a + boundingRect(), and a minimumWidth() and a maximumWidth(). + + \sa QStaticText */ |