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 > PaintAttributestypedef 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 () constbool isNull () constbool isEmpty () constvoid setFont (const QFont &)QFont font () constโ Return the font.QFont usedFont (const QFont &) constvoid setRenderFlags (int)โ Change the render flags.int renderFlags () constvoid setColor (const QColor &)QColor color () constโ Return the pen color, used for painting the text.QColor usedColor (const QColor &) constvoid setBorderRadius (double)double borderRadius () constvoid setBorderPen (const QPen &)QPen borderPen () constvoid setBackgroundBrush (const QBrush &)QBrush backgroundBrush () constvoid setPaintAttribute (PaintAttribute, bool on=true)bool testPaintAttribute (PaintAttribute) constvoid setLayoutAttribute (LayoutAttribute, bool on=true)bool testLayoutAttribute (LayoutAttribute) constdouble heightForWidth (double width) constdouble heightForWidth (double width, const QFont &) constQSizeF textSize () constQSizeF textSize (const QFont &) constvoid 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 specialQwtTextEnginefor that format can handle. - Background โ A text might have a background, defined by a
QPenandQBrushto 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::AlignmentFlagandQt::TextFlagused like inQPainter::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 ofLayoutAttributevalues. Definition at line 143 of fileqwt_text.h.typedef QFlags<PaintAttribute > QwtText::PaintAttributesโ an ORed combination ofPaintAttributevalues. Definition at line 126 of fileqwt_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. IfQwtTextEngine::textMarginsis not implemented for the format of the text,MinimumLayouthas 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 usingQwtTextEngine::mightRender()for all available text engines in increasing order >PlainText. If none of the text engines can render the text, it is rendered likeQwtText::PlainText.PlainTextโ Draw the text as it is, using aQwtPlainTextEngine.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 usingsetTextEngine. Formats >=QwtText::OtherFormatare 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 contenttextFormatโ 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 bysetFont(),setColor(),setBorderPen()andsetBackgroundBrush().
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 inQPainter::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
- alpine 3.24: qwt-doc 6.3.0-r0 ยท custom
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms