QwtText(3)

๐ŸŽ€ NAME ๐ŸŽ€

okay bestie, welcome to QwtText(3) from the Library Functions Manual ๐Ÿ’–

QwtText โ€” a class representing a text. Thatโ€™s the name section, and itโ€™s honestly iconic.


โœจ SYNOPSIS โœจ

#include <qwt_text.h>

๐ŸŒˆ Public Types ๐ŸŒˆ

  • enum TextFormat { AutoText = 0, PlainText, RichText, MathMLText, TeXText, OtherFormat = 100 } โ€” Text format.
  • enum PaintAttribute { PaintUsingTextFont = 0x01, PaintUsingTextColor = 0x02, PaintBackground = 0x04 } โ€” Paint Attributes.
  • enum LayoutAttribute { MinimumLayout = 0x01 } โ€” Layout Attributes. These affect some aspects of the layout of the text.
  • typedef QFlags< PaintAttribute > PaintAttributes
  • typedef QFlags< LayoutAttribute > LayoutAttributes

๐Ÿ’… Public Member Functions ๐Ÿ’…

  • QwtText ()
  • QwtText (const QString &, TextFormat textFormat=AutoText)
  • QwtText (const QwtText &) โ€” Copy constructor.
  • ~QwtText () โ€” Destructor.
  • QwtText & operator= (const QwtText &) โ€” Assignment operator.
  • bool operator== (const QwtText &) const โ€” Relational operator.
  • bool operator!= (const QwtText &) const โ€” Relational operator.
  • void setText (const QString &, QwtText::TextFormat textFormat=AutoText)
  • QString text () const
  • bool isNull () const
  • bool isEmpty () const
  • void setFont (const QFont &)
  • QFont font () const โ€” Return the font.
  • QFont usedFont (const QFont &) const
  • void setRenderFlags (int) โ€” Change the render flags.
  • int renderFlags () const
  • void setColor (const QColor &)
  • QColor color () const โ€” Return the pen color, used for painting the text.
  • QColor usedColor (const QColor &) const
  • void setBorderRadius (double)
  • double borderRadius () const
  • void setBorderPen (const QPen &)
  • QPen borderPen () const
  • void setBackgroundBrush (const QBrush &)
  • QBrush backgroundBrush () const
  • void setPaintAttribute (PaintAttribute, bool on=true)
  • bool testPaintAttribute (PaintAttribute) const
  • void setLayoutAttribute (LayoutAttribute, bool on=true)
  • bool testLayoutAttribute (LayoutAttribute) const
  • double heightForWidth (double width) const
  • double heightForWidth (double width, const QFont &) const
  • QSizeF textSize () const
  • QSizeF textSize (const QFont &) const
  • void draw (QPainter *painter, const QRectF &rect) const

๐Ÿฆ‹ Static Public Member Functions ๐Ÿฆ‹

  • static const QwtTextEngine * textEngine (const QString &text, QwtText::TextFormat=AutoText)
  • static const QwtTextEngine * textEngine (QwtText::TextFormat) โ€” Find the text engine for a text format.
  • static void setTextEngine (QwtText::TextFormat, QwtTextEngine *)

๐Ÿ’– Detailed Description ๐Ÿ’–

A QwtText is literally a text plus the set of attributes that say how to render it.

  • Format โ€” A text might include control sequences (for example tags) describing how to render it. Each format (for example MathML, TeX, Qt Rich Text) has its own set of control sequences, which a special QwtTextEngine for that format can handle.
  • Background โ€” A text might have a background, defined by a QPen and QBrush to improve its visibility. The corners of the background might be rounded.
  • 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

Definition at line 51 of file qwt_text.h.


๐Ÿงต Member Typedef Documentation ๐Ÿงต

  • typedef QFlags<LayoutAttribute > QwtText::LayoutAttributes โ€” an ORed combination of LayoutAttribute values. Definition at line 143 of file qwt_text.h.
  • typedef QFlags<PaintAttribute > QwtText::PaintAttributes โ€” an ORed combination of PaintAttribute values. Definition at line 126 of file qwt_text.h.

๐Ÿ”ฎ Member Enumeration Documentation ๐Ÿ”ฎ

enum QwtText::LayoutAttribute

Layout Attributes. These affect some aspects of the layout of the text.

Enumerator

  • 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.

Definition at line 132 of file qwt_text.h.

enum QwtText::PaintAttribute

Paint Attributes. Font, color, and background are optional attributes of a QwtText. The paint attributes hold the information about whether theyโ€™re set.

Enumerator

  • PaintUsingTextFont โ€” The text has an individual font.
  • PaintUsingTextColor โ€” The text has an individual color.
  • PaintBackground โ€” The text has an individual background.

Definition at line 114 of file qwt_text.h.

enum QwtText::TextFormat

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

See also: QwtTextEngine, setTextEngine()

Enumerator

  • 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, it is rendered like QwtText::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. In earlier versions of Qwt such an engine was included โ€” since Qwt 6.2 it can be found here: https://github.com/uwerat/qwt-mml-dev

To enable MathML support the following code needs to be added to the application: QwtText::setTextEngine( QwtText::MathMLText, new QwtMathMLTextEngine() );

  • TeXText โ€” Use a TeX (http://en.wikipedia.org/wiki/TeX) render engine to display the text ( not implemented yet ).
  • OtherFormat โ€” The number of text formats can be extended using setTextEngine. Formats >= QwtText::OtherFormat are not used by Qwt.

Definition at line 64 of file qwt_text.h.


๐Ÿ› ๏ธ Constructor & Destructor Documentation ๐Ÿ› ๏ธ

QwtText::QwtText ()

Constructor.

Definition at line 201 of file qwt_text.cpp.

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

Constructor.

Parameters

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

Definition at line 215 of file qwt_text.cpp.

QwtText::QwtText (const QwtText & other)

Copy constructor.

Definition at line 225 of file qwt_text.cpp.

QwtText::~QwtText ()

Destructor.

Definition at line 235 of file qwt_text.cpp.

๐ŸŽ€ Member Function Documentation ๐ŸŽ€

okay bestie, every single function is getting its moment now โ€” no skips, no โ€œweโ€™ll come back to it,โ€ periodt. ๐Ÿ’…

๐ŸŒธ QBrush QwtText::backgroundBrush () const

This one hands you the background brush, no cap.

Returns: background brush.

See also: setBackgroundBrush(), borderPen().

Definition at line 451 of file qwt_text.cpp.

๐ŸŒธ QPen QwtText::borderPen () const

Gives you the background pen โ€” yes, thatโ€™s literally what it returns.

Returns: background pen.

See also: setBorderPen(), backgroundBrush().

Definition at line 430 of file qwt_text.cpp.

๐ŸŒธ double QwtText::borderRadius () const

Returns the radius for the corners of the border frame. Cute little rounded-corner situation ๐Ÿ’…

Returns: radius for the corners of the border frame.

See also: setBorderRadius(), borderPen(), backgroundBrush().

Definition at line 409 of file qwt_text.cpp.

๐ŸŒธ QColor QwtText::color () const

Returns the pen color used for painting the text. color moment ๐ŸŽจ

Returns: the pen color, used for painting the text.

Definition at line 372 of file qwt_text.cpp.

๐ŸŒธ void QwtText::draw (QPainter * painter, const QRectF & rect) const

Draws a text into a rectangle. Main-character drawing behavior โœจ

Parameters:

  • painter โ€” painter.
  • rect โ€” rectangle.

Definition at line 615 of file qwt_text.cpp.

๐ŸŒธ QFont QwtText::font () const

Returns the font. font reveal ๐Ÿซถ

Returns: the font.

Definition at line 336 of file qwt_text.cpp.

๐ŸŒธ double QwtText::heightForWidth (double width) const

Finds the height for a given width. Itโ€™s giving โ€œmath but make it usefulโ€ ๐Ÿ˜ญ

Parameters:

  • width โ€” width.

Returns: calculated height.

Definition at line 522 of file qwt_text.cpp.

๐ŸŒธ double QwtText::heightForWidth (double width, const QFont & defaultFont) const

Same height-for-width situation, but with a fallback font in the mix.

Parameters:

  • defaultFont โ€” font used for the calculation if the text has no font.
  • width โ€” width.

Returns: calculated height.

Definition at line 535 of file qwt_text.cpp.

๐ŸŒธ bool QwtText::isEmpty () const

Literally returns text().isEmpty(). The emptiness check is delegated, and it ate ๐Ÿ’…

Returns: text().isEmpty().

Definition at line 739 of file qwt_text.cpp.

๐ŸŒธ bool QwtText::isNull () const

Returns text().isNull(). Null check, but make it text-coded.

Returns: text().isNull().

Definition at line 733 of file qwt_text.cpp.

๐ŸŒธ bool QwtText::operator!= (const QwtText & other) const

Relational operator. The โ€œare these two not matching?โ€ vibe check between texts.

Returns: relational operator result.

Definition at line 264 of file qwt_text.cpp.

๐ŸŒธ QwtText & QwtText::operator= (const QwtText & other)

Assignment operator. Copies the assignment vibe from other, bestie.

Definition at line 242 of file qwt_text.cpp.

๐ŸŒธ bool QwtText::operator== (const QwtText & other) const

Relational operator. The โ€œare these two matching?โ€ vibe check between texts.

Returns: relational operator result.

Definition at line 250 of file qwt_text.cpp.

๐ŸŒธ int QwtText::renderFlags () const

Returns the render flags. flags unlocked ๐Ÿšฉ

Returns: render flags.

See also: setRenderFlags().

Definition at line 317 of file qwt_text.cpp.

๐ŸŒธ void QwtText::setBackgroundBrush (const QBrush & brush)

Sets the background brush. brush upgrade ๐Ÿ–Œ๏ธ

Parameters:

  • brush โ€” background brush.

See also: backgroundBrush(), setBorderPen().

Definition at line 441 of file qwt_text.cpp.

๐ŸŒธ void QwtText::setBorderPen (const QPen & pen)

Sets the background pen. Yes, โ€œbackground pen,โ€ thatโ€™s the wording โ€” we respect the lore.

Parameters:

  • pen โ€” background pen.

See also: borderPen(), setBackgroundBrush().

Definition at line 420 of file qwt_text.cpp.

๐ŸŒธ void QwtText::setBorderRadius (double radius)

Sets the radius for the corners of the border frame. Rounded corners are a personality ๐Ÿ’…

Parameters:

  • radius โ€” radius of a rounded corner.

See also: borderRadius(), setBorderPen(), setBackgroundBrush().

Definition at line 400 of file qwt_text.cpp.

๐ŸŒธ void QwtText::setColor (const QColor & color)

Sets the pen color used for drawing the text. color assignment ๐ŸŽจ

Parameters:

  • color โ€” color.
Note: Setting the color might have no effect, when the text contains control sequences for setting colors.

Definition at line 365 of file qwt_text.cpp.

๐ŸŒธ void QwtText::setFont (const QFont & font)

Sets the font. font assignment โœจ

Parameters:

  • font โ€” font.
Note: Setting the font might have no effect, when the text contains control sequences for setting fonts.

Definition at line 329 of file qwt_text.cpp.

๐ŸŒธ void QwtText::setLayoutAttribute (LayoutAttribute attribute, bool on = true)

Changes a layout attribute. Toggle it on or off, bestie.

Parameters:

  • attribute โ€” layout attribute.
  • on โ€” on/off.

See also: testLayoutAttribute().

Definition at line 494 of file qwt_text.cpp.

๐ŸŒธ void QwtText::setPaintAttribute (PaintAttribute attribute, bool on = true)

Changes a paint attribute. Toggle it on or off, same energy.

Parameters:

  • attribute โ€” paint attribute.
  • on โ€” on/off.
Note: Used by setFont(), setColor(), setBorderPen() and setBackgroundBrush().

See also: testPaintAttribute().

Definition at line 466 of file qwt_text.cpp.

๐ŸŒธ void QwtText::setRenderFlags (int renderFlags)

Changes the render flags. The default setting is Qt::AlignCenter โ€” iconic default behavior ๐Ÿ‘‘

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.

Definition at line 304 of file qwt_text.cpp.

๐ŸŒธ void QwtText::setText (const QString & text, QwtText::TextFormat textFormat = AutoText)

Assigns a new text content. New text, who dis? ๐Ÿ’–

Parameters:

  • text โ€” text content.
  • textFormat โ€” text format.

See also: text().

Definition at line 277 of file qwt_text.cpp.

๐ŸŒธ void QwtText::setTextEngine (QwtText::TextFormat format, QwtTextEngine * engine) [static]

Assigns/replaces a text engine for a text format. With setTextEngine it is possible to extend Qwt with other types of text formats. extend the lore ๐ŸŒˆ

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

Parameters:

  • format โ€” text format.
  • engine โ€” text engine.
Warning: Using QwtText::AutoText does nothing.

Definition at line 713 of file qwt_text.cpp.

๐ŸŒธ bool QwtText::testLayoutAttribute (LayoutAttribute attribute) const

Tests a layout attribute.

Parameters:

  • attribute โ€” layout attribute.

Returns: true, if attribute is enabled.

See also: setLayoutAttribute().

Definition at line 510 of file qwt_text.cpp.

๐ŸŒธ bool QwtText::testPaintAttribute (PaintAttribute attribute) const

Tests a paint attribute.

Parameters:

  • attribute โ€” paint attribute.

Returns: true, if attribute is enabled.

See also: setPaintAttribute().

Definition at line 482 of file qwt_text.cpp.

๐ŸŒธ QString QwtText::text () const

Returns the text as a QString. The raw text reveal moment ๐Ÿซถ

Returns: text as QString.

See also: setText().

Definition at line 289 of file qwt_text.cpp.

๐ŸŒธ const QwtTextEngine * QwtText::textEngine (const QString & text, QwtText::TextFormat format = AutoText) [static]

Finds 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 returned.

If no text engine is registered for the format QwtPlainTextEngine is returned.

Parameters:

  • text โ€” text, needed in case of AutoText.
  • format โ€” text format.

Returns: corresponding text engine.

Definition at line 694 of file qwt_text.cpp.

๐ŸŒธ const QwtTextEngine * QwtText::textEngine (QwtText::TextFormat format) [static]

Finds the text engine for a text format. textEngine can be used to find out if a text format is supported. Detective behavior ๐Ÿ”

Parameters:

  • format โ€” text format.

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

Definition at line 727 of file qwt_text.cpp.

๐ŸŒธ QSizeF QwtText::textSize () const

Returns the size that is needed to render text. Size check, but make it texty ๐Ÿ“

Returns: calculated size.

Definition at line 570 of file qwt_text.cpp.

๐ŸŒธ QSizeF QwtText::textSize (const QFont & defaultFont) const

Returns the size that is needed to render text, with a default font in the mix.

Parameters:

  • defaultFont โ€” font of the text.

Returns: calculated size.

Definition at line 581 of file qwt_text.cpp.

๐ŸŒธ QColor QwtText::usedColor (const QColor & defaultColor) const

Returns the color of the text if it has one. Otherwise returns defaultColor. Fallback color behavior, slay ๐ŸŽ€

Parameters:

  • defaultColor โ€” default color.

Returns: color used for drawing the text.

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

Definition at line 386 of file qwt_text.cpp.

๐ŸŒธ QFont QwtText::usedFont (const QFont & defaultFont) const

Returns the font of the text if it has one. Otherwise returns defaultFont. Fallback font behavior, iconic ๐Ÿ’…

Parameters:

  • defaultFont โ€” default font.

Returns: font used for drawing the text.

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

Definition at line 350 of file qwt_text.cpp.


๐Ÿ‘‘ Author ๐Ÿ‘‘

Generated automatically by Doxygen for Qwt Userโ€™s Guide from the source code. Robots did the typing, and honestly? They ate. ๐Ÿค–โœจ


Byeee bestie ๐Ÿซถ โ€” footer shoutout to the Qwt Userโ€™s Guide source/version, the QwtText(3) page, and the build date doing its little timestamp moment at the bottom. Periodt. ๐Ÿ’…๐ŸŒˆ

๐Ÿ“ฆ where this page comes from