QWT 7.0.1
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
QwtTextEngine Class Referenceabstract

Abstract base class for rendering text strings. More...

#include <qwt_text_engine.h>

Inheritance diagram for QwtTextEngine:
QwtPlainTextEngine QwtRichTextEngine

Public Member Functions

virtual ~QwtTextEngine ()
 Destructor.
 
virtual double heightForWidth (const QFont &font, int flags, const QString &text, double width) const =0
 Find the height for a given width.
 
virtual QSizeF textSize (const QFont &font, int flags, const QString &text) const =0
 Returns the size, that is needed to render text.
 
virtual bool mightRender (const QString &text) const =0
 Test if a string can be rendered by this text engine.
 
virtual void textMargins (const QFont &font, const QString &text, double &left, double &right, double &top, double &bottom) const =0
 Return margins around the texts.
 
virtual void draw (QPainter *painter, const QRectF &rect, int flags, const QString &text) const =0
 Draw the text in a clipping rectangle.
 

Protected Member Functions

 QwtTextEngine ()
 Constructor.
 

Detailed Description

Abstract base class for rendering text strings.

A text engine is responsible for rendering texts for a specific text format. They are used by QwtText to render a text.

See also
QwtText::setTextEngine()

Member Function Documentation

◆ draw()

virtual void QwtTextEngine::draw ( QPainter *  painter,
const QRectF &  rect,
int  flags,
const QString &  text 
) const
pure virtual

Draw the text in a clipping rectangle.

Parameters
painterPainter
rectClipping rectangle
flagsBitwise OR of the flags like in for QPainter::drawText()
textText to be rendered

Implemented in QwtPlainTextEngine, and QwtRichTextEngine.

◆ heightForWidth()

virtual double QwtTextEngine::heightForWidth ( const QFont &  font,
int  flags,
const QString &  text,
double  width 
) const
pure virtual

Find the height for a given width.

Parameters
fontFont of the text
flagsBitwise OR of the flags used like in QPainter::drawText
textText to be rendered
widthWidth
Returns
Calculated height

Implemented in QwtPlainTextEngine, and QwtRichTextEngine.

◆ mightRender()

virtual bool QwtTextEngine::mightRender ( const QString &  text) const
pure virtual

Test if a string can be rendered by this text engine.

Parameters
textText to be tested
Returns
true, if it can be rendered

Implemented in QwtPlainTextEngine, and QwtRichTextEngine.

◆ textMargins()

virtual void QwtTextEngine::textMargins ( const QFont &  font,
const QString &  text,
double &  left,
double &  right,
double &  top,
double &  bottom 
) const
pure virtual

Return margins around the texts.

The textSize might include margins around the text, like QFontMetrics::descent(). In situations where texts need to be aligned in detail, knowing these margins might improve the layout calculations.

Parameters
fontFont of the text
textText to be rendered
leftReturn value for the left margin
rightReturn value for the right margin
topReturn value for the top margin
bottomReturn value for the bottom margin

Implemented in QwtPlainTextEngine, and QwtRichTextEngine.

◆ textSize()

virtual QSizeF QwtTextEngine::textSize ( const QFont &  font,
int  flags,
const QString &  text 
) const
pure virtual

Returns the size, that is needed to render text.

Parameters
fontFont of the text
flagsBitwise OR of the flags like in for QPainter::drawText
textText to be rendered
Returns
Calculated size

Implemented in QwtPlainTextEngine, and QwtRichTextEngine.


The documentation for this class was generated from the following files: