A virtual textlayout. More...
#include <textlayout.h>
Public Member Functions | |
TextLayout (TextDocument *document) | |
virtual | ~TextLayout () |
void | setCacheEnabled (bool enable) |
QTextLayout * | qTextLayout () const |
QRectF | boundingRect () const |
void | buildLayout () |
int | toVirtualCursorPosition (int cursor) const |
Converts the document cursorPosition to a virtual cursorposition. | |
int | fromVirtualCursorPosition (int cursor) const |
Converts the virtual cursorPosition to a docuemnt cursorposition. | |
void | draw (QPainter *p, const QPointF &pos, const QVector< QTextLayout::FormatRange > &selections=QVector< QTextLayout::FormatRange >(), const QRectF &clip=QRectF()) const |
void | drawCursor (QPainter *painter, const QPointF &position, int cursorPosition, int width) const |
void | setFormats (const QVector< QTextLayout::FormatRange > &formats) |
void | setText (const QString &string) |
void | useSingleCharRanges () |
TextRangeSet * | singleCharRanges () const |
void | addSingleCharRange (int index, int length) |
qreal | cursorToX (int cursorPos, QTextLine::Edge edge=QTextLine::Leading) const |
These calculations manipulate the cursor position. .. | |
int | xToCursor (qreal x, QTextLine::CursorPosition cpos=QTextLine::CursorBetweenCharacters) const |
Protected Attributes | |
QTextLayout * | qtextLayout_ |
TextDocument * | textDocumentRef_ |
TextRangeSet * | singleCharRanges_ |
A list textRanges_ used by TextLayout. Every range in this list is treatet as a single character for cusor-movement etc. | |
QTextLine | qtextLine_ |
A virtual textlayout.
This class wraps the QTextLayout used for rendering. Modifying all cursor/positioning related methods, supporting single-cursor items, while rendering multiple QTextLayout characters
Note: this is very Edbee specific. Every TextLayout has got a single line!
edbee::TextLayout::TextLayout | ( | TextDocument * | document | ) |
|
virtual |
void edbee::TextLayout::addSingleCharRange | ( | int | index, |
int | length ) |
QRectF edbee::TextLayout::boundingRect | ( | ) | const |
void edbee::TextLayout::buildLayout | ( | ) |
qreal edbee::TextLayout::cursorToX | ( | int | cursorPos, |
QTextLine::Edge | edge = QTextLine::Leading ) const |
These calculations manipulate the cursor position. ..
void edbee::TextLayout::draw | ( | QPainter * | p, |
const QPointF & | pos, | ||
const QVector< QTextLayout::FormatRange > & | selections = QVector<QTextLayout::FormatRange>(), | ||
const QRectF & | clip = QRectF() ) const |
void edbee::TextLayout::drawCursor | ( | QPainter * | painter, |
const QPointF & | position, | ||
int | cursorPosition, | ||
int | width ) const |
int edbee::TextLayout::fromVirtualCursorPosition | ( | int | cursor | ) | const |
Converts the virtual cursorPosition to a docuemnt cursorposition.
QTextLayout * edbee::TextLayout::qTextLayout | ( | ) | const |
void edbee::TextLayout::setCacheEnabled | ( | bool | enable | ) |
void edbee::TextLayout::setFormats | ( | const QVector< QTextLayout::FormatRange > & | formats | ) |
void edbee::TextLayout::setText | ( | const QString & | string | ) |
TextRangeSet * edbee::TextLayout::singleCharRanges | ( | ) | const |
int edbee::TextLayout::toVirtualCursorPosition | ( | int | cursor | ) | const |
Converts the document cursorPosition to a virtual cursorposition.
void edbee::TextLayout::useSingleCharRanges | ( | ) |
int edbee::TextLayout::xToCursor | ( | qreal | x, |
QTextLine::CursorPosition | cpos = QTextLine::CursorBetweenCharacters ) const |
|
protected |
|
protected |
|
protected |
A list textRanges_ used by TextLayout. Every range in this list is treatet as a single character for cusor-movement etc.
|
protected |