Eneboo - Documentación para desarrolladores
Métodos públicos | Atributos públicos estáticos | Métodos protegidos
Referencia de la Clase QCanvasText

The QCanvasText class provides a text object on a QCanvas.canvasA canvas text item has text with font, color and alignment attributes. The text and font can be set in the constructor or set or changed later with setText() and setFont(). The color is set with setColor() and the alignment with setTextFlags(). The text item's bounding rectangle is retrieved with boundingRect(). Más...

#include <qcanvas.h>

Diagrama de herencias de QCanvasText
QCanvasItem QCanvasItem Qt Qt Qt Qt

Lista de todos los miembros.

Métodos públicos

 QCanvasText (QCanvas *canvas)
 QCanvasText (const QString &, QCanvas *canvas)
 QCanvasText (const QString &, QFont, QCanvas *canvas)
virtual ~QCanvasText ()
void setText (const QString &)
void setFont (const QFont &)
void setColor (const QColor &)
QString text () const
QFont font () const
QColor color () const
void moveBy (double dx, double dy)
int textFlags () const
void setTextFlags (int)
QRect boundingRect () const
bool collidesWith (const QCanvasItem *) const
int rtti () const
 QCanvasText (QCanvas *canvas)
 QCanvasText (const QString &, QCanvas *canvas)
 QCanvasText (const QString &, QFont, QCanvas *canvas)
virtual ~QCanvasText ()
void setText (const QString &)
void setFont (const QFont &)
void setColor (const QColor &)
QString text () const
QFont font () const
QColor color () const
void moveBy (double dx, double dy)
int textFlags () const
void setTextFlags (int)
QRect boundingRect () const
bool collidesWith (const QCanvasItem *) const
int rtti () const

Atributos públicos estáticos

static int RTTI = Rtti_Text

Métodos protegidos

virtual void draw (QPainter &)
virtual void draw (QPainter &)

Descripción detallada

The QCanvasText class provides a text object on a QCanvas.

canvas

A canvas text item has text with font, color and alignment attributes. The text and font can be set in the constructor or set or changed later with setText() and setFont(). The color is set with setColor() and the alignment with setTextFlags(). The text item's bounding rectangle is retrieved with boundingRect().

The text can be drawn on a painter with draw().

Like any other canvas item text items can be moved with QCanvasItem::move() and QCanvasItem::moveBy(), or by setting coordinates with QCanvasItem::setX(), QCanvasItem::setY() and QCanvasItem::setZ().


Documentación del constructor y destructor

QCanvasText::QCanvasText ( QCanvas canvas)

Constructs a QCanvasText with the text "\<text\>", on canvas.

QCanvasText::QCanvasText ( const QString t,
QCanvas canvas 
)

Constructs a QCanvasText with the text t, on canvas canvas.

QCanvasText::QCanvasText ( const QString t,
QFont  f,
QCanvas canvas 
)

Constructs a QCanvasText with the text t and font f, on the canvas canvas.

QCanvasText::~QCanvasText ( ) [virtual]

Destroys the canvas text item.

QCanvasText::QCanvasText ( QCanvas canvas)
QCanvasText::QCanvasText ( const QString ,
QCanvas canvas 
)
QCanvasText::QCanvasText ( const QString ,
QFont  ,
QCanvas canvas 
)
virtual QCanvasText::~QCanvasText ( ) [virtual]

Documentación de las funciones miembro

QRect QCanvasText::boundingRect ( ) const [virtual]

Returns the bounding rectangle of the text.

Implementa QCanvasItem.

QRect QCanvasText::boundingRect ( ) const [virtual]

Returns the bounding rectangle in pixels that the canvas item covers.

Ver también:
boundingRectAdvanced()

Implementa QCanvasItem.

bool QCanvasText::collidesWith ( const QCanvasItem i) const [virtual]

Implementa QCanvasItem.

bool QCanvasText::collidesWith ( const QCanvasItem other) const [virtual]

Returns TRUE if the canvas item will collide with the other item after they have moved by their current velocities; otherwise returns FALSE.

Ver también:
collisions()

Implementa QCanvasItem.

QColor QCanvasText::color ( ) const
QColor QCanvasText::color ( ) const

Returns the color of the text.

Ver también:
setColor()
void QCanvasText::draw ( QPainter painter) [protected, virtual]

Draws the text using the painter painter.

Implementa QCanvasItem.

virtual void QCanvasText::draw ( QPainter painter) [protected, virtual]

This abstract virtual function draws the canvas item using painter.

Atención:
When you reimplement this function, make sure that you leave the painter in the same state as you found it. For example, if you start by calling QPainter::translate(50, 50), end your code by calling QPainter::translate(-50, -50). Be also aware that the painter might already have some transformations set (i.e., don't call QPainter::resetXForm() when you're done).

Implementa QCanvasItem.

QFont QCanvasText::font ( ) const
QFont QCanvasText::font ( ) const

Returns the font in which the text is drawn.

Ver también:
setFont()
void QCanvasText::moveBy ( double  dx,
double  dy 
) [virtual]

Moves the canvas item relative to its current position by (dx, dy).

Reimplementado de QCanvasItem.

void QCanvasText::moveBy ( double  dx,
double  dy 
) [virtual]

Reimplementado de QCanvasItem.

int QCanvasText::rtti ( ) const [virtual]

Returns 0 (QCanvasItem::Rtti_Item).

Make your derived classes return their own values for rtti(), so that you can distinguish between objects returned by QCanvas::at(). You should use values greater than 1000 to allow for extensions to this class.

Overuse of this functionality can damage it's extensibility. For example, once you have identified a base class of a QCanvasItem found by QCanvas::at(), cast it to that type and call meaningful methods rather than acting upon the object based on its rtti value.

For example:

        QCanvasItem* item;
        // Find an item, e.g. with QCanvasItem::collisions().
        ...
        if (item->rtti() == MySprite::RTTI ) {
            MySprite* s = (MySprite*)item;
            if (s->isDamagable()) s->loseHitPoints(1000);
            if (s->isHot()) myself->loseHitPoints(1000);
            ...
        }

Reimplementado de QCanvasItem.

int QCanvasText::rtti ( ) const [virtual]

Returns 3 (QCanvasItem::Rtti_Text).

Ver también:
QCanvasItem::rtti()

Reimplementado de QCanvasItem.

void QCanvasText::setColor ( const QColor )
void QCanvasText::setColor ( const QColor c)

Sets the color of the text to the color c.

Ver también:
color(), setFont()
void QCanvasText::setFont ( const QFont f)

Sets the font in which the text is drawn to font f.

Ver también:
font()
void QCanvasText::setFont ( const QFont )
void QCanvasText::setText ( const QString )
void QCanvasText::setText ( const QString t)

Sets the text item's text to t. The text may contain newlines.

Ver también:
text(), setFont(), setColor() setTextFlags()
void QCanvasText::setTextFlags ( int  f)

Sets the alignment flags to f. These are a bitwise OR of the flags available to QPainter::drawText() -- see the {Qt::AlignmentFlags}.

Ver también:
setFont() setColor()
void QCanvasText::setTextFlags ( int  )
QString QCanvasText::text ( ) const
QString QCanvasText::text ( ) const

Returns the text item's text.

Ver también:
setText()
int QCanvasText::textFlags ( ) const [inline]
int QCanvasText::textFlags ( ) const [inline]

Returns the currently set alignment flags.

Ver también:
setTextFlags() Qt::AlignmentFlags

Documentación de los datos miembro

static int QCanvasText::RTTI = Rtti_Text [static]

Reimplementado de QCanvasItem.


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'