Eneboo - Documentación para desarrolladores
Clases | Tipos públicos | Métodos públicos | Métodos públicos estáticos
Referencia de la Clase QwtText

A class representing a text. Más...

#include <qwt_text.h>

Lista de todos los miembros.

Clases

class  LayoutCache
class  PrivateData

Tipos públicos

enum  TextFormat {
  AutoText = 0, PlainText, RichText, MathMLText,
  TeXText, OtherFormat = 100
}
 Text format. Más...
enum  PaintAttribute { PaintUsingTextFont = 1, PaintUsingTextColor = 2, PaintBackground = 4 }
 Paint Attributes. Más...
enum  LayoutAttribute { MinimumLayout = 1 }
 Layout Attributes. Más...

Métodos públicos

 QwtText (const QString &=QString::null, TextFormat textFormat=AutoText)
 QwtText (const QwtText &)
 Copy constructor.
 ~QwtText ()
 Destructor.
QwtTextoperator= (const QwtText &)
 Assignement operator.
int operator== (const QwtText &) const
int operator!= (const QwtText &) const
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 setBackgroundPen (const QPen &)
QPen backgroundPen () 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
int heightForWidth (int width, const QFont &=QFont()) const
QSize textSize (const QFont &=QFont()) const
void draw (QPainter *painter, const QRect &rect) const

Métodos públicos estáticos

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

Descripción detallada

A class representing a text.

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

Ver también:
QwtTextEngine, QwtTextLabel

Documentación de las enumeraciones miembro de la clase

Layout Attributes.

The layout attributes affects some aspects of the layout of the text.

  • 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.
Valores de enumeraciones:
MinimumLayout 

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.
Valores de enumeraciones:
PaintUsingTextFont 
PaintUsingTextColor 
PaintBackground 

Text format.

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

  • 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 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. Unfortunately it is only available for owners of a commercial Qt license.
  • 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 >= OtherFormat are not used by Qwt.
Ver también:
QwtTextEngine, setTextEngine
Valores de enumeraciones:
AutoText 
PlainText 
RichText 
MathMLText 
TeXText 
OtherFormat 

Documentación del constructor y destructor

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

Constructor

Parámetros:
textText content
textFormatText format
QwtText::QwtText ( const QwtText other)

Copy constructor.

QwtText::~QwtText ( )

Destructor.


Documentación de las funciones miembro

QBrush QwtText::backgroundBrush ( ) const
Devuelve:
Background brush
Ver también:
setBackgroundBrush, backgroundPen
QPen QwtText::backgroundPen ( ) const
Devuelve:
Background pen
Ver también:
setBackgroundPen, backgroundBrush
QColor QwtText::color ( ) const

Return the pen color, used for painting the text.

void QwtText::draw ( QPainter painter,
const QRect rect 
) const

Draw a text into a rectangle

Parámetros:
painterPainter
rectRectangle
QFont QwtText::font ( ) const

Return the font.

int QwtText::heightForWidth ( int  width,
const QFont defaultFont = QFont() 
) const

Find the height for a given width

Parámetros:
defaultFontFont, used for the calculation if the text has no font
widthWidth
Devuelve:
Calculated height
bool QwtText::isEmpty ( void  ) const [inline]
Devuelve:
text().isEmpty()
bool QwtText::isNull ( ) const [inline]
Devuelve:
text().isNull()
int QwtText::operator!= ( const QwtText other) const
QwtText & QwtText::operator= ( const QwtText other)

Assignement operator.

int QwtText::operator== ( const QwtText other) const
int QwtText::renderFlags ( ) const
Devuelve:
Render flags
Ver también:
setRenderFlags
void QwtText::setBackgroundBrush ( const QBrush brush)

Set the background brush

Parámetros:
brushBackground brush
Ver también:
backgroundBrush, setBackgroundPen
void QwtText::setBackgroundPen ( const QPen pen)

Set the background pen

Parámetros:
penBackground pen
Ver también:
backgroundPen, setBackgroundBrush
void QwtText::setColor ( const QColor color)

Set the pen color used for painting the text.

Parámetros:
colorColor
Nota:
Setting the color might have no effect, when the text contains control sequences for setting colors.
void QwtText::setFont ( const QFont font)

Set the font.

Parámetros:
fontFont
Nota:
Setting the font might have no effect, when the text contains control sequences for setting fonts.
void QwtText::setLayoutAttribute ( LayoutAttribute  attribute,
bool  on = true 
)

Change a layout attribute

Parámetros:
attributeLayout attribute
onOn/Off
Ver también:
testLayoutAttribute
void QwtText::setPaintAttribute ( PaintAttribute  attribute,
bool  on = true 
)

Change a paint attribute

Parámetros:
attributePaint attribute
onOn/Off
Nota:
Used by setFont, setColor, setBackgroundPen and setBackgroundBrush
Ver también:
testPaintAttribute
void QwtText::setRenderFlags ( int  renderFlags)

Change the render flags.

The default setting is Qt::AlignCenter

Parámetros:
renderFlagsBitwise OR of the flags used like in QPainter::drawText
Ver también:
renderFlags, QwtTextEngine::draw
Nota:
Some renderFlags might have no effect, depending on the text format.
void QwtText::setText ( const QString text,
QwtText::TextFormat  textFormat = AutoText 
)

Assign a new text content

Parámetros:
textText content
textFormatText format
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.

Parámetros:
formatText format
engineText engine
Ver también:
QwtMathMLTextEngine
Atención:
Using QwtText::AutoText does nothing.
bool QwtText::testLayoutAttribute ( LayoutAttribute  attribute) const

Test a layout attribute

Parámetros:
attributeLayout attribute
Devuelve:
true, if attribute is enabled
Ver también:
setLayoutAttribute
bool QwtText::testPaintAttribute ( PaintAttribute  attribute) const

Test a paint attribute

Parámetros:
attributePaint attribute
Devuelve:
true, if attribute is enabled
Ver también:
setPaintAttribute
QString QwtText::text ( ) const

Return the text.

Ver también:
setText
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.

Parámetros:
formatText format
Devuelve:
The text engine, or NULL if no engine is available.
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.

Parámetros:
textText, needed in case of AutoText
formatText format
QSize QwtText::textSize ( const QFont defaultFont = QFont()) const

Find the height for a given width

Parámetros:
defaultFontFont, used for the calculation if the text has no font
Devuelve:
Calculated height

Returns the size, that is needed to render text

Parámetros:
defaultFontFont of the text
Devuelve:
Caluclated size
QColor QwtText::usedColor ( const QColor defaultColor) const

Return the color of the text, if it has one. Otherwise return defaultColor.

Parámetros:
defaultColorDefault color
Ver también:
setColor, color, PaintAttributes
QFont QwtText::usedFont ( const QFont defaultFont) const

Return the font of the text, if it has one. Otherwise return defaultFont.

Parámetros:
defaultFontDefault font
Ver también:
setFont, font, PaintAttributes

La documentación para esta clase fue generada a partir de los siguientes ficheros:
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'