QwtText(3)

πŸ“¦ version 5.2.3a, in epel 9, fedora 43, fedora 44

πŸŽ€ NAME πŸŽ€

QwtText πŸ’… β€” straight out of the Qwt User's Guide, manual section 3, so QwtText(3) if you're keeping receipts.


✨ SYNOPSIS ✨

#include <qwt_text.h>

🌸 Public Types

enum LayoutAttribute { MinimumLayout =  1 }
enum PaintAttribute { PaintUsingTextFont =  1, PaintUsingTextColor =  2, PaintBackground =  4 }
enum TextFormat { AutoText =  0, PlainText, RichText, MathMLText, TeXText, OtherFormat =  100 }

πŸ¦‹ Public Member Functions

  • QwtText (const QString &=QString::null, TextFormat textFormat=AutoText) β€” the main-character constructor, makes a text
  • QwtText (const QwtText &) β€” copy constructor, clone that vibe
  • ~QwtText () β€” destructor, it's over bestie
  • QBrush backgroundBrush () const β€” hands you the background brush
  • QPen backgroundPen () const β€” hands you the background pen
  • QColor color () const β€” hands you the color
  • void draw (QPainter *painter, const QRect &rect) const β€” paints the text into a rect
  • QFont font () const β€” hands you the font
  • int heightForWidth (int width, const QFont &=QFont()) const β€” how tall is this text at this width
  • bool isEmpty () const β€” is the text empty
  • bool isNull () const β€” is the text null
  • int operator!= (const QwtText &) const β€” not-equal check between two texts
  • QwtText & operator= (const QwtText &) β€” assignment, copy the whole girl over
  • int operator== (const QwtText &) const β€” equality check (yes it returns int, that's just how it is, periodt)
  • int renderFlags () const β€” reads back the render flags
  • void setBackgroundBrush (const QBrush &) β€” sets the background brush
  • void setBackgroundPen (const QPen &) β€” sets the background pen
  • void setColor (const QColor &) β€” sets the color
  • void setFont (const QFont &) β€” sets the font
  • void setLayoutAttribute (LayoutAttribute, bool on=true) β€” flips a layout attribute on/off
  • void setPaintAttribute (PaintAttribute, bool on=true) β€” flips a paint attribute on/off
  • void setRenderFlags (int flags) β€” sets the render flags
  • void setText (const QString &, QwtText::TextFormat textFormat=AutoText) β€” swaps in new text content
  • bool testLayoutAttribute (LayoutAttribute) const β€” is this layout attribute on?
  • bool testPaintAttribute (PaintAttribute) const β€” is this paint attribute on?
  • QString text () const β€” gives you the text back
  • QSize textSize (const QFont &=QFont()) const β€” how big does this text need to be
  • QColor usedColor (const QColor &) const β€” the color it actually uses
  • QFont usedFont (const QFont &) const β€” the font it actually uses

🧚 Static Public Member Functions

  • static void setTextEngine (QwtText::TextFormat, QwtTextEngine *) β€” plug in or replace a text engine for a format
  • static const QwtTextEngine * textEngine (const QString &text, QwtText::TextFormat=AutoText) β€” find the engine for some text
  • static const QwtTextEngine * textEngine (QwtText::TextFormat) β€” find the engine for a format

πŸ’– Detailed Description πŸ’–

A class representing a text.

Okay so a QwtText is literally just a text plus a whole little wardrobe of attributes telling you how to render it. It's giving text with lore.

  • Format β€” a text might include control sequences (f.e tags) describing how to render it. Each format (f.e MathML, TeX, Qt Rich Text) has its own set of control sequences, that a QwtTextEngine for that format can handle.
  • Background β€” a text might have a background, defined by a QPen and QBrush to improve its visibility.
  • Font β€” a text might have an individual font.
  • Color β€” a text might have an individual color.
  • Render Flags β€” flags from Qt::AlignmentFlag and Qt::TextFlag used like in QPainter::drawText.

See also: QwtTextEngine, QwtTextLabel


🌈 Member Enumeration Documentation 🌈

πŸ’œ enum QwtText::LayoutAttribute

Layout Attributes. The layout attributes affects some aspects of the layout of the text. (their words, and honestly slay)

  • MinimumLayout β€” layout the text without its margins. This mode is useful if a text needs to be aligned accurately, like the tick labels of a scale. If QwtTextEngine::textMargins is not implemented for the format of the text, MinimumLayout has no effect. so like, no cap, it might just do nothing sometimes πŸ™ˆ

πŸ’œ enum QwtText::PaintAttribute

Paint Attributes. Font and color and background are optional attributes of a QwtText. The paint attributes hold the information, if they are set.

  • PaintUsingTextFont β€” the text has an individual font.
  • PaintUsingTextColor β€” the text has an individual color.
  • PaintBackground β€” the text has an individual background.

πŸ’œ enum QwtText::TextFormat

Text format. The text format defines the QwtTextEngine, that is used to render the text.

  • AutoText β€” the text format is determined using QwtTextEngine::mightRender for all available text engines in increasing order > PlainText. If none of the text engines can render the text is rendered like PlainText.
  • PlainText β€” draw the text as it is, using a QwtPlainTextEngine.
  • RichText β€” use the Scribe framework (Qt Rich Text) to render the text.
  • MathMLText β€” use a MathML (http://en.wikipedia.org/wiki/MathML) render engine to display the text. The Qwt MathML extension offers such an engine based on the MathML renderer of the Qt solutions package. Unfortunately it is only available for owners of a commercial Qt license. πŸ’€ tragic honestly
  • TeXText β€” use a TeX (http://en.wikipedia.org/wiki/TeX) render engine to display the text.
  • OtherFormat β€” the number of text formats can be extended using setTextEngine. Formats >= OtherFormat are not used by Qwt.

See also: QwtTextEngine, setTextEngine()


🫢 Constructor & Destructor Documentation 🫢

⭐ QwtText::QwtText (const QString &text = QString::null, QwtText::TextFormat textFormat = AutoText)

Constructor. ✨

Parameters:

  • text β€” Text content
  • textFormat β€” Text format

πŸ‘‘ Member Function Documentation πŸ‘‘

⭐ QBrush QwtText::backgroundBrush () const

Returns: Background brush

See also: setBackgroundBrush(), backgroundPen()

⭐ QPen QwtText::backgroundPen () const

Returns: Background pen

See also: setBackgroundPen(), backgroundBrush()

⭐ void QwtText::draw (QPainter *painter, const QRect &rect) const

Draw a text into a rectangle.

Parameters:

  • painter β€” Painter
  • rect β€” Rectangle

⭐ int QwtText::heightForWidth (int width, const QFont &defaultFont = QFont()) const

Find the height for a given width.

Parameters:

  • defaultFont β€” Font, used for the calculation if the text has no font
  • width β€” Width

Returns: Calculated height

⭐ bool QwtText::isEmpty () const [inline]

Returns: text().isEmpty()

⭐ bool QwtText::isNull () const [inline]

Returns: text().isNull()

⭐ int QwtText::renderFlags () const

Returns: Render flags

See also: setRenderFlags()

⭐ void QwtText::setBackgroundBrush (const QBrush &brush)

Set the background brush.

Parameters:

  • brush β€” Background brush

See also: backgroundBrush(), setBackgroundPen()

⭐ void QwtText::setBackgroundPen (const QPen &pen)

Set the background pen.

Parameters:

  • pen β€” Background pen

See also: backgroundPen(), setBackgroundBrush()

⭐ void QwtText::setColor (const QColor &color)

Set the pen color used for painting the text.

Parameters:

  • color β€” Color
Note: setting the color might have no effect, when the text contains control sequences for setting colors. so like, sometimes it just doesn't listen to you bestie 😭

⭐ void QwtText::setFont (const QFont &font)

Set the font.

Parameters:

  • font β€” Font
Note: setting the font might have no effect, when the text contains control sequences for setting fonts. same energy, the control sequences are the ones in charge here πŸ’…

⭐ void QwtText::setLayoutAttribute (LayoutAttribute attribute, bool on = true)

Change a layout attribute.

Parameters:

  • attribute β€” Layout attribute
  • on β€” On/Off

See also: testLayoutAttribute()

⭐ void QwtText::setPaintAttribute (PaintAttribute attribute, bool on = true)

Change a paint attribute.

Parameters:

  • attribute β€” Paint attribute
  • on β€” On/Off
Note: used by setFont(), setColor(), setBackgroundPen() and setBackgroundBrush()

See also: testPaintAttribute()

⭐ void QwtText::setRenderFlags (int renderFlags)

Change the render flags. The default setting is Qt::AlignCenter.

Parameters:

  • renderFlags β€” Bitwise OR of the flags used like in QPainter::drawText

See also: renderFlags(), QwtTextEngine::draw()

Note: some renderFlags might have no effect, depending on the text format. iykyk

⭐ void QwtText::setText (const QString &text, QwtText::TextFormat textFormat = AutoText)

Assign a new text content.

Parameters:

  • text β€” Text content
  • textFormat β€” Text format

See also: text()

⭐ void QwtText::setTextEngine (QwtText::TextFormat format, QwtTextEngine *engine) [static]

Assign/Replace a text engine for a text format.

With setTextEngine it is possible to extend Qwt with other types of text formats.

Owner of a commercial Qt license can build the qwtmathml library, that is based on the MathML renderer, that is included in MML Widget component of the Qt solutions package.

For QwtText::PlainText it is not allowed to assign a engine == NULL.

Parameters:

  • format β€” Text format
  • engine β€” Text engine

See also: QwtMathMLTextEngine

Warning: using QwtText::AutoText does nothing. literally nothing. don't do it 🚫

⭐ bool QwtText::testLayoutAttribute (LayoutAttribute attribute) const

Test a layout attribute.

Parameters:

  • attribute β€” Layout attribute

Returns: true, if attribute is enabled

See also: setLayoutAttribute()

⭐ bool QwtText::testPaintAttribute (PaintAttribute attribute) const

Test a paint attribute.

Parameters:

  • attribute β€” Paint attribute

Returns: true, if attribute is enabled

See also: setPaintAttribute()

⭐ QString QwtText::text () const

Return the text.

See also: setText()

⭐ const QwtTextEngine * QwtText::textEngine (const QString &text, QwtText::TextFormat format = AutoText) [static]

Find the text engine for a text format.

In case of QwtText::AutoText the first text engine (beside QwtPlainTextEngine) is returned, where QwtTextEngine::mightRender returns true. If there is none QwtPlainTextEngine is returnd.

If no text engine is registered for the format QwtPlainTextEngine is returnd. (yep, "returnd", that's their spelling, not mine 😭)

Parameters:

  • text β€” Text, needed in case of AutoText
  • format β€” Text format

⭐ const QwtTextEngine * QwtText::textEngine (QwtText::TextFormat format) [static]

Find the text engine for a text format. textEngine can be used to find out if a text format is supported. F.e, if one wants to use MathML labels, the MathML renderer from the commercial Qt solutions package might be required, that is not available in Qt Open Source Edition environments.

Parameters:

  • format β€” Text format

Returns: The text engine, or NULL if no engine is available.

⭐ QSize QwtText::textSize (const QFont &defaultFont = QFont()) const

Find the height for a given width.

Parameters:

  • defaultFont β€” Font, used for the calculation if the text has no font

Returns: Calculated height

Returns the size, that is needed to render text.

Parameters:

  • defaultFont β€” Font of the text

Returns: Caluclated size (again β€” their typo, keeping it for the record 🫢)

⭐ QColor QwtText::usedColor (const QColor &defaultColor) const

Return the color of the text, if it has one. Otherwise return defaultColor.

Parameters:

  • defaultColor β€” Default color

See also: setColor(), color(), PaintAttributes

⭐ QFont QwtText::usedFont (const QFont &defaultFont) const

Return the font of the text, if it has one. Otherwise return defaultFont.

Parameters:

  • defaultFont β€” Default font

See also: setFont(), font(), PaintAttributes


✨ AUTHOR ✨

okay so real talk, nobody wrote this page with their own two hands and a little mug of tea πŸ’– it was generated automatically by Doxygen for Qwt User's Guide from the source code. so like, the source code is the actual main character here, and Doxygen is just the little robot bestie transcribing the vibes πŸŽ€ no cap, that's the whole author situation. the code spoke, Doxygen typed it up, and now we're all here together reading it. iconic honestly πŸ’…


and that's a wrap, bestie!! πŸ¦‹βœ¨

this page came from Version 5.2.3, dated Tue Nov 20 2012 β€” yeah, it's giving vintage, it's giving classic, it's giving elder emoji πŸ’€ but the knowledge is timeless fr fr. go forth and QwtText responsibly 🫢🌸

mwah πŸ’‹

πŸ“¦ where this page comes from