QwtText(3)
π 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 textQwtText (const QwtText &)β copy constructor, clone that vibe~QwtText ()β destructor, it's over bestieQBrush backgroundBrush () constβ hands you the background brushQPen backgroundPen () constβ hands you the background penQColor color () constβ hands you the colorvoid draw (QPainter *painter, const QRect &rect) constβ paints the text into a rectQFont font () constβ hands you the fontint heightForWidth (int width, const QFont &=QFont()) constβ how tall is this text at this widthbool isEmpty () constβ is the text emptybool isNull () constβ is the text nullint operator!= (const QwtText &) constβ not-equal check between two textsQwtText & operator= (const QwtText &)β assignment, copy the whole girl overint operator== (const QwtText &) constβ equality check (yes it returnsint, that's just how it is, periodt)int renderFlags () constβ reads back the render flagsvoid setBackgroundBrush (const QBrush &)β sets the background brushvoid setBackgroundPen (const QPen &)β sets the background penvoid setColor (const QColor &)β sets the colorvoid setFont (const QFont &)β sets the fontvoid setLayoutAttribute (LayoutAttribute, bool on=true)β flips a layout attribute on/offvoid setPaintAttribute (PaintAttribute, bool on=true)β flips a paint attribute on/offvoid setRenderFlags (int flags)β sets the render flagsvoid setText (const QString &, QwtText::TextFormat textFormat=AutoText)β swaps in new text contentbool testLayoutAttribute (LayoutAttribute) constβ is this layout attribute on?bool testPaintAttribute (PaintAttribute) constβ is this paint attribute on?QString text () constβ gives you the text backQSize textSize (const QFont &=QFont()) constβ how big does this text need to beQColor usedColor (const QColor &) constβ the color it actually usesQFont 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 formatstatic const QwtTextEngine * textEngine (const QString &text, QwtText::TextFormat=AutoText)β find the engine for some textstatic 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
QwtTextEnginefor that format can handle. - Background β a text might have a background, defined by a
QPenandQBrushto improve its visibility. - 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
π 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::textMarginsis not implemented for the format of the text,MinimumLayouthas 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::mightRenderfor all available text engines in increasing order >PlainText. If none of the text engines can render the text is rendered likePlainText. - 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 >=OtherFormatare 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 bysetFont(),setColor(),setBackgroundPen()andsetBackgroundBrush()
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
- epel 9: qwt5-qt5-devel 5.2.3a-12.20210522gita2b11e3.el9 Β· LGPLv2+ with exceptions
- fedora 43: qwt5-qt5-devel 5.2.3a-22.20210522gita2b11e3.fc43 Β· LGPL-2.1-or-later WITH Qwt-exception-1.0
- fedora 43: qwt5-qt5-devel 5.2.3a-22.20210522gita2b11e3.fc43 Β· LGPL-2.1-or-later WITH Qwt-exception-1.0
- fedora 44: qwt5-qt5-devel 5.2.3a-23.20210522gita2b11e3.fc44 Β· LGPL-2.1-or-later WITH Qwt-exception-1.0
- fedora 44: qwt5-qt5-devel 5.2.3a-23.20210522gita2b11e3.fc44 Β· LGPL-2.1-or-later WITH Qwt-exception-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms