edbee - Qt Editor Library
|
A class for rendering the text. More...
#include <textrenderer.h>
Public Slots | |
void | invalidateTextLayoutCaches (int fromLine=0) |
Invalidates the QTextLayout caches. More... | |
void | invalidateCaches () |
call this method to invalidate all caches! More... | |
Public Member Functions | |
TextRenderer (TextEditorController *controller) | |
The default textrenderer constructor. More... | |
virtual | ~TextRenderer () |
the destructor More... | |
virtual void | init () |
The init method is called if all objects required for editing have been created! More... | |
virtual void | reset () |
This method resets all caching information. More... | |
int | lineHeight () |
This method returns the (maximum) line-height in pixels. More... | |
int | rawLineIndexForYpos (int y) |
This method converts the give y position to a line index Warning this returns a RAW line index, which means it can be an invalid line. More... | |
int | lineIndexForYpos (int y) |
This method returns a valid line index for the given y-pos If the y-position isn't on a line it returns a value < 0. More... | |
int | totalWidth () |
Returns the total width of the editor. This method is NOT the real with This method takes the maximum line length and multiplies it with the widest character. More... | |
int | totalHeight () |
This method returns the total height. More... | |
int | emWidth () |
This method returns width of the M cahracter. More... | |
int | nrWidth () |
The M-width isn't good enough for calculating the width of numbers. Often the M is to wide. That why we have a nr width which takes the 8 for the width. More... | |
int | viewHeightInLines () |
This method returns the number of lines. More... | |
int | firstVisibleLine () |
This method returns the first visible line. More... | |
int | columnIndexForXpos (int line, int x) |
This method returns the (closet) valid column for the given x-position. More... | |
int | xPosForColumn (int line, int column) |
This method returns the x position for the given column. More... | |
int | xPosForOffset (int offset) |
This method returns the x-coordinate for the given offset. More... | |
int | yPosForLine (int line) |
This method returns the y position for the given line. More... | |
int | yPosForOffset (int offset) |
This method returns the offset position for the given line. More... | |
QTextLayout * | textLayoutForLine (int line) |
This method returns the textlayout for the given line. More... | |
void | renderBegin (const QRect &rect) |
This method starts rendering. More... | |
void | renderEnd (const QRect &rect) |
This method starts rendering. More... | |
TextDocument * | textDocument () |
This method returns the document. More... | |
TextSelection * | textSelection () |
This method returns the textselection. More... | |
TextEditorConfig * | config () |
Returns the editor configuration. More... | |
TextEditorController * | controller () |
returns a reference to the given controller More... | |
TextEditorWidget * | textWidget () |
This method returns the widget. More... | |
void | setViewport (const QRect &viewport) |
Sets the current viewport of the renderer. More... | |
void | resetCaretTime () |
sets the caret time on 0 More... | |
bool | shouldRenderCaret () |
this method returnst true if the caret is visible More... | |
bool | isCaretVisible () |
Returns true if the caret is visible. More... | |
void | setCaretVisible (bool visible) |
sets the carets to visible or invisible More... | |
QRect | viewport () |
int | viewportX () |
int | viewportY () |
int | viewportWidth () |
int | viewportHeight () |
TextThemeStyler * | themeStyler () |
QString | themeName () const |
returns the current theme name More... | |
TextTheme * | theme () |
Returns the active theme. More... | |
void | setThemeByName (const QString &name) |
Selects the active theme name. More... | |
void | setTheme (TextTheme *theme) |
sets the theme More... | |
const QRect * | clipRect () |
This method is valid only while rendering! More... | |
int | startOffset () |
This method is valid only while rendering! More... | |
int | endOffset () |
This method is valid only while rendering! More... | |
int | startLine () |
This method is valid only while rendering! More... | |
int | endLine () |
This method is valid only while rendering! More... | |
Protected Slots | |
void | textDocumentChanged (edbee::TextDocument *oldDocument, edbee::TextDocument *newDocument) |
The text-document has been changed. More... | |
void | textChanged (edbee::TextBufferChange change) |
The text is replaced. More... | |
void | lastScopedOffsetChanged (int previousOffset, int newOffset) |
The scoped to offset has been changed. More... | |
A class for rendering the text.
edbee::TextRenderer::TextRenderer | ( | TextEditorController * | controller | ) |
The default textrenderer constructor.
|
virtual |
the destructor
|
inline |
This method is valid only while rendering!
int edbee::TextRenderer::columnIndexForXpos | ( | int | line, |
int | x | ||
) |
This method returns the (closet) valid column for the given x-position.
TextEditorConfig * edbee::TextRenderer::config | ( | ) |
Returns the editor configuration.
TextEditorController * edbee::TextRenderer::controller | ( | ) |
returns a reference to the given controller
int edbee::TextRenderer::emWidth | ( | ) |
This method returns width of the M cahracter.
|
inline |
This method is valid only while rendering!
|
inline |
This method is valid only while rendering!
int edbee::TextRenderer::firstVisibleLine | ( | ) |
This method returns the first visible line.
|
virtual |
The init method is called if all objects required for editing have been created!
|
slot |
call this method to invalidate all caches!
|
slot |
Invalidates the QTextLayout caches.
bool edbee::TextRenderer::isCaretVisible | ( | ) |
Returns true if the caret is visible.
|
protectedslot |
The scoped to offset has been changed.
int edbee::TextRenderer::lineHeight | ( | ) |
This method returns the (maximum) line-height in pixels.
int edbee::TextRenderer::lineIndexForYpos | ( | int | y | ) |
This method returns a valid line index for the given y-pos If the y-position isn't on a line it returns a value < 0.
int edbee::TextRenderer::nrWidth | ( | ) |
The M-width isn't good enough for calculating the width of numbers. Often the M is to wide. That why we have a nr width which takes the 8 for the width.
int edbee::TextRenderer::rawLineIndexForYpos | ( | int | y | ) |
This method converts the give y position to a line index Warning this returns a RAW line index, which means it can be an invalid line.
y | the y position |
void edbee::TextRenderer::renderBegin | ( | const QRect & | rect | ) |
This method starts rendering.
void edbee::TextRenderer::renderEnd | ( | const QRect & | rect | ) |
This method starts rendering.
|
virtual |
This method resets all caching information.
void edbee::TextRenderer::resetCaretTime | ( | ) |
sets the caret time on 0
void edbee::TextRenderer::setCaretVisible | ( | bool | visible | ) |
sets the carets to visible or invisible
void edbee::TextRenderer::setTheme | ( | TextTheme * | theme | ) |
sets the theme
theme | the them to set |
void edbee::TextRenderer::setThemeByName | ( | const QString & | name | ) |
Selects the active theme name.
void edbee::TextRenderer::setViewport | ( | const QRect & | viewport | ) |
Sets the current viewport of the renderer.
bool edbee::TextRenderer::shouldRenderCaret | ( | ) |
this method returnst true if the caret is visible
|
inline |
This method is valid only while rendering!
|
inline |
This method is valid only while rendering!
|
protectedslot |
The text is replaced.
TextDocument * edbee::TextRenderer::textDocument | ( | ) |
This method returns the document.
|
protectedslot |
The text-document has been changed.
QTextLayout * edbee::TextRenderer::textLayoutForLine | ( | int | line | ) |
TextSelection * edbee::TextRenderer::textSelection | ( | ) |
This method returns the textselection.
TextEditorWidget * edbee::TextRenderer::textWidget | ( | ) |
This method returns the widget.
TextTheme * edbee::TextRenderer::theme | ( | ) |
Returns the active theme.
QString edbee::TextRenderer::themeName | ( | ) | const |
returns the current theme name
|
inline |
int edbee::TextRenderer::totalHeight | ( | ) |
This method returns the total height.
int edbee::TextRenderer::totalWidth | ( | ) |
Returns the total width of the editor. This method is NOT the real with This method takes the maximum line length and multiplies it with the widest character.
int edbee::TextRenderer::viewHeightInLines | ( | ) |
This method returns the number of lines.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
int edbee::TextRenderer::xPosForColumn | ( | int | line, |
int | column | ||
) |
This method returns the x position for the given column.
int edbee::TextRenderer::xPosForOffset | ( | int | offset | ) |
This method returns the x-coordinate for the given offset.
int edbee::TextRenderer::yPosForLine | ( | int | line | ) |
This method returns the y position for the given line.
int edbee::TextRenderer::yPosForOffset | ( | int | offset | ) |
This method returns the offset position for the given line.