QwtText (3) - Linux Manuals
NAME
QwtText -
SYNOPSIS
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 The layout attributes affects some aspects of the layout of the text.
typedef QFlags< PaintAttribute > PaintAttributes
Paint attributes.
typedef QFlags< LayoutAttribute > LayoutAttributes
Layout attributes.
Public Member Functions
QwtText (const QString &=QString::null, 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 flags)
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
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 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().
See Also:
- QwtTextEngine, QwtTextLabel
Member Enumeration Documentation
enum QwtText::LayoutAttribute
Layout Attributes The layout attributes affects 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.
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.
Enumerator
- 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.
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 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 Qt solutions package. To enable MathML support the following code needs to be added to the application:
Parameters:
Returns:
See Also:
Returns:
See Also:
Returns:
See Also:
Parameters:
Parameters:
Returns:
Returns:
Returns:
Returns:
See Also:
Parameters:
See Also:
Parameters:
See Also:
Parameters:
See Also:
Parameters:
Note:
Parameters:
Note:
Parameters:
See Also:
Parameters:
Note:
See Also:
Change the render flags. The default setting is Qt::AlignCenter
Parameters:
See Also:
Note:
Parameters:
See Also:
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:
See Also:
Warning:
Parameters:
Returns:
See Also:
Parameters:
Returns:
See Also:
Returns:
See Also:
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:
Returns:
Find the text engine for a text format. textEngine can be used to find out if a text format is supported.
Parameters:
Returns:
Parameters:
Returns:
Returns the size, that is needed to render text
Parameters:
Returns:
Parameters:
Returns:
See Also:
Parameters:
Returns:
See Also:
Generated automatically by Doxygen for Qwt User's Guide from the source code.
QwtText::setTextEngine(QwtText::MathMLText, new QwtMathMLTextEngine());
Constructor & Destructor Documentation
QwtText::QwtText (const QString &text = QString::null, QwtText::TextFormattextFormat = AutoText)
Constructor
textFormat Text format
Member Function Documentation
QBrush QwtText::backgroundBrush () const
QPen QwtText::borderPen () const
double QwtText::borderRadius () const
void QwtText::draw (QPainter *painter, const QRectF &rect) const
Draw a text into a rectangle
rect Rectangle
double QwtText::heightForWidth (doublewidth, const QFont &defaultFont = QFont()) const
Find the height for a given width
width Width
bool QwtText::isEmpty () const [inline]
bool QwtText::isNull () const [inline]
int QwtText::renderFlags () const
void QwtText::setBackgroundBrush (const QBrush &brush)
Set the background brush
void QwtText::setBorderPen (const QPen &pen)
Set the background pen
void QwtText::setBorderRadius (doubleradius)
Set the radius for the corners of the border frame
void QwtText::setColor (const QColor &color)
Set the pen color used for drawing the text.
void QwtText::setFont (const QFont &font)
Set the font.
void QwtText::setLayoutAttribute (LayoutAttributeattribute, boolon = true)
Change a layout attribute
on On/Off
void QwtText::setPaintAttribute (PaintAttributeattribute, boolon = true)
Change a paint attribute
on On/Off
void QwtText::setRenderFlags (intrenderFlags)
void QwtText::setText (const QString &text, QwtText::TextFormattextFormat = AutoText)
Assign a new text content
textFormat Text format
void QwtText::setTextEngine (QwtText::TextFormatformat, QwtTextEngine *engine) [static]
Assign/Replace a text engine for a text format
engine Text engine
bool QwtText::testLayoutAttribute (LayoutAttributeattribute) const
Test a layout attribute
bool QwtText::testPaintAttribute (PaintAttributeattribute) const
Test a paint attribute
QString QwtText::text () const
const QwtTextEngine * QwtText::textEngine (const QString &text, QwtText::TextFormatformat = AutoText) [static]
Find the text engine for a text format
format Text format
const QwtTextEngine * QwtText::textEngine (QwtText::TextFormatformat) [static]
QSizeF QwtText::textSize (const QFont &defaultFont = QFont()) const
Find the height for a given width
QColor QwtText::usedColor (const QColor &defaultColor) const
Return the color of the text, if it has one. Otherwise return defaultColor.
QFont QwtText::usedFont (const QFont &defaultFont) const
Return the font of the text, if it has one. Otherwise return defaultFont.
Author