QwtTextEngine(3)

πŸ’… QwtTextEngine β€” Library Functions Manual energy, bestie

okay so picture this: you're out here tryna render text strings in a specific format, and this abstract base class is the blueprint. It's QwtTextEngine, and honestly? She's the main character of text rendering. ✨


πŸ¦‹ NAME

QwtTextEngine β€” the abstract base class for rendering text strings, no cap.


πŸŽ€ SYNOPSIS

#include <qwt_text_engine.h>

Inherited by: QwtPlainTextEngine, and QwtRichTextEngine β€” they're the ones actually doing the visible work, we're just the vibe here. πŸ‘‘

🌸 Public Member Functions

  • virtual ~QwtTextEngine () β€” destructor, she's got to go eventually 😭
  • virtual double heightForWidth (const QFont &font, int flags, const QString &text, double width) const =0 β€” pure virtual, you must implement this
  • virtual QSizeF textSize (const QFont &font, int flags, const QString &text) const =0
  • virtual bool mightRender (const QString &text) const =0
  • virtual void textMargins (const QFont &font, const QString &text, double &left, double &right, double &top, double &bottom) const =0
  • virtual void draw (QPainter *painter, const QRectF &rect, int flags, const QString &text) const =0

🧚 Protected Member Functions

  • QwtTextEngine () β€” constructor, protected because she's exclusive πŸ’œ

✨ Detailed Description

Abstract base class for rendering text strings. Periodt.

A text engine is responsible for rendering texts for a specific text format β€” so like, imagine each engine is a different aesthetic. They are used by QwtText to render a text.

See also: QwtText::setTextEngine()

Definition at line 30 of file qwt_text_engine.h. πŸ“

🫢 Constructor & Destructor Documentation

QwtTextEngine::~QwtTextEngine () [virtual]

Destructor. Saying bye bestie πŸ‘‹

Definition at line 146 of file qwt_text_engine.cpp.

QwtTextEngine::QwtTextEngine () [protected]

Constructor. Protected, so only the chosen ones can build her β€” iykyk.

Definition at line 141 of file qwt_text_engine.cpp.

🌈 Member Function Documentation

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

Draw the text in a clipping rectangle. It's giving aesthetic boundaries.

Parameters:

  • painter β€” Painter
  • rect β€” Clipping rectangle
  • flags β€” Bitwise OR of the flags like in for QPainter::drawText()
  • text β€” Text to be rendered

Implemented in: QwtPlainTextEngine, and QwtRichTextEngine.

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

Find the height for a given width β€” like math but make it fashion. πŸ“

Parameters:

  • font β€” Font of the text
  • flags β€” Bitwise OR of the flags used like in QPainter::drawText
  • text β€” Text to be rendered
  • width β€” Width

Returns: Calculated height

Implemented in: QwtPlainTextEngine, and QwtRichTextEngine.

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

Test if a string can be rendered by this text engine β€” a little vibe check on your string. πŸ”

Parameters:

  • text β€” Text to be tested

Returns: true, if it can be rendered

Implemented in: QwtPlainTextEngine, and QwtRichTextEngine.

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. So like, if you're a perfectionist about alignment β€” this is your moment.

Parameters:

  • font β€” Font of the text
  • text β€” Text to be rendered
  • left β€” Return value for the left margin
  • right β€” Return value for the right margin
  • top β€” Return value for the top margin
  • bottom β€” Return value for the bottom margin

Implemented in: QwtPlainTextEngine, and QwtRichTextEngine.

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

Returns the size, that is needed to render text β€” the literal measurements of the situation. πŸ“

Parameters:

  • font β€” Font of the text
  • flags β€” Bitwise OR of the flags like in for QPainter::drawText
  • text β€” Text to be rendered

Returns: Calculated size

Implemented in: QwtPlainTextEngine, and QwtRichTextEngine.


πŸ“ Author

Generated automatically by Doxygen for Qwt User's Guide from the source code. Not me writing it by hand, the robot did it πŸ’€


and that's the whole page bestie!! slay πŸ’– this whole thing came straight from Qwt User's Guide and was living under the QwtTextEngine(3) label in the Library Functions Manual β€” be sure to stan the source before you go πŸ«Άβœ¨πŸŽ€

πŸ“¦ where this page comes from