logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

QwtText - A class representing a text.

Author

       Generated automatically by Doxygen for Qwt User's Guide from the source code.

Version 6.1.4                                    Wed Jan 2 2019                                       QwtText(3)

Constructor & Destructor Documentation

QwtText::QwtText(constQString&text=QString(),QwtText::TextFormattextFormat=AutoText)
       Constructor

       Parameters:text Text content
           textFormat Text format

Detailed Description

       A class representing a text.

       A QwtText is a text including a set of attributes how to render it.

       • 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  can  be  handles  by  a  special
         QwtTextEngine for this format.

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

       Seealso:QwtTextEngine, QwtTextLabel

Member Enumeration Documentation

enumQwtText::LayoutAttribute
       Layout Attributes The layout attributes affects some aspects of the layout of the text.

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

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

       EnumeratorPaintUsingTextFont
              The text has an individual font.

       PaintUsingTextColor
              The text has an individual color.

       PaintBackground
              The text has an individual background.

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

       Seealso:QwtTextEngine, setTextEngine()EnumeratorAutoText
              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
              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.  The  Qwt
              MathML  extension  offers  such  an engine based on the MathML renderer of the former Qt solutions
              package. 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.

Member Function Documentation

QBrushQwtText::backgroundBrush()constReturns:
           Background brush

       Seealso:setBackgroundBrush(), borderPen()QPenQwtText::borderPen()constReturns:
           Background pen

       Seealso:setBorderPen(), backgroundBrush()doubleQwtText::borderRadius()constReturns:
           Radius for the corners of the border frame

       Seealso:setBorderRadius(), borderPen(), backgroundBrush()voidQwtText::draw(QPainter*painter,constQRectF&rect)const
       Draw a text into a rectangle

       Parameters:painter Painter
           rect Rectangle

   doubleQwtText::heightForWidth(doublewidth,constQFont&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

   boolQwtText::isEmpty()const[inline]Returns:text().isEmpty()boolQwtText::isNull()const[inline]Returns:text().isNull()intQwtText::renderFlags()constReturns:
           Render flags

       Seealso:setRenderFlags()voidQwtText::setBackgroundBrush(constQBrush&brush)
       Set the background brush

       Parameters:brush Background brush

       Seealso:backgroundBrush(), setBorderPen()voidQwtText::setBorderPen(constQPen&pen)
       Set the background pen

       Parameters:pen Background pen

       Seealso:borderPen(), setBackgroundBrush()voidQwtText::setBorderRadius(doubleradius)
       Set the radius for the corners of the border frame

       Parameters:radius Radius of a rounded corner

       Seealso:borderRadius(), setBorderPen(), setBackgroundBrush()voidQwtText::setColor(constQColor&color)
       Set the pen color used for drawing the text.

       Parameters:color Color

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

   voidQwtText::setFont(constQFont&font)
       Set the font.

       Parameters:font Font

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

   voidQwtText::setLayoutAttribute(LayoutAttributeattribute,boolon=true)
       Change a layout attribute

       Parameters:attribute Layout attribute
           on On/Off

       Seealso:testLayoutAttribute()voidQwtText::setPaintAttribute(PaintAttributeattribute,boolon=true)
       Change a paint attribute

       Parameters:attribute Paint attribute
           on On/Off

       Note:
           Used by setFont(), setColor(), setBorderPen() and setBackgroundBrush()Seealso:testPaintAttribute()voidQwtText::setRenderFlags(intrenderFlags)
       Change the render flags. The default setting is Qt::AlignCenter

       Parameters:renderFlags Bitwise OR of the flags used like in QPainter::drawText()

       Seealso:renderFlags(), QwtTextEngine::draw()Note:
           Some renderFlags might have no effect, depending on the text format.

   voidQwtText::setText(constQString&text,QwtText::TextFormattextFormat=AutoText)
       Assign a new text content

       Parameters:text Text content
           textFormat Text format

       Seealso:text()voidQwtText::setTextEngine(QwtText::TextFormatformat,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.

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

       Parameters:format Text format
           engine Text engine

       Seealso:QwtMathMLTextEngineWarning:
           Using QwtText::AutoText does nothing.

   boolQwtText::testLayoutAttribute(LayoutAttributeattribute)const
       Test a layout attribute

       Parameters:attribute Layout attribute

       Returns:
           true, if attribute is enabled

       Seealso:setLayoutAttribute()boolQwtText::testPaintAttribute(PaintAttributeattribute)const
       Test a paint attribute

       Parameters:attribute Paint attribute

       Returns:
           true, if attribute is enabled

       Seealso:setPaintAttribute()QStringQwtText::text()constReturns:
           Text as QString.

       Seealso:setText()constQwtTextEngine*QwtText::textEngine(constQString&text,QwtText::TextFormatformat=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 returned.

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

       Parameters:text Text, needed in case of AutoText
           format Text format

       Returns:
           Corresponding text engine

   constQwtTextEngine*QwtText::textEngine(QwtText::TextFormatformat)[static]
       Find the text engine for a text format. textEngine can be used to find out if a text format is supported.

       Parameters:format Text format

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

   QSizeFQwtText::textSize(constQFont&defaultFont=QFont())const
       Returns the size, that is needed to render text

       Parameters:defaultFont Font of the text

       Returns:
           Calculated size

   QColorQwtText::usedColor(constQColor&defaultColor)const
       Return the color of the text, if it has one. Otherwise return defaultColor.

       Parameters:defaultColor Default color

       Returns:
           Color used for drawing the text

       Seealso:setColor(), color(), PaintAttributesQFontQwtText::usedFont(constQFont&defaultFont)const
       Return the font of the text, if it has one. Otherwise return defaultFont.

       Parameters:defaultFont Default font

       Returns:
           Font used for drawing the text

       Seealso:setFont(), font(), PaintAttributes

Name

       QwtText - A class representing a text.

Synopsis

       #include <qwt_text.h>

   PublicTypes
       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 The layout attributes affects some aspects of the layout of the text.
       typedef QFlags< PaintAttribute > PaintAttributes
           Paint attributes.
       typedef QFlags< LayoutAttribute > LayoutAttributes
           Layout attributes.

   PublicMemberFunctionsQwtText (const QString &=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 QFont &=QFont()) const
       QSizeF textSize (const QFont &=QFont()) const
       void draw (QPainter *painter, const QRectF &rect) const

   StaticPublicMemberFunctions
       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 *)

See Also