Eneboo - Documentación para desarrolladores
|
The QCanvasRectangle class provides a rectangle on a QCanvas.canvasThis item paints a single rectangle which may have any pen() and brush(), but may not be tilted/rotated. For rotated rectangles, use QCanvasPolygon. Más...
#include <qcanvas.h>
Métodos públicos | |
QCanvasRectangle (QCanvas *canvas) | |
QCanvasRectangle (const QRect &, QCanvas *canvas) | |
QCanvasRectangle (int x, int y, int width, int height, QCanvas *canvas) | |
~QCanvasRectangle () | |
int | width () const |
int | height () const |
void | setSize (int w, int h) |
QSize | size () const |
QPointArray | areaPoints () const |
QRect | rect () const |
bool | collidesWith (const QCanvasItem *) const |
int | rtti () const |
QCanvasRectangle (QCanvas *canvas) | |
QCanvasRectangle (const QRect &, QCanvas *canvas) | |
QCanvasRectangle (int x, int y, int width, int height, QCanvas *canvas) | |
~QCanvasRectangle () | |
int | width () const |
int | height () const |
void | setSize (int w, int h) |
QSize | size () const |
QPointArray | areaPoints () const |
QRect | rect () const |
bool | collidesWith (const QCanvasItem *) const |
int | rtti () const |
Atributos públicos estáticos | |
static int | RTTI = Rtti_Rectangle |
Métodos protegidos | |
void | drawShape (QPainter &) |
QPointArray | chunks () const |
void | drawShape (QPainter &) |
QPointArray | chunks () const |
The QCanvasRectangle class provides a rectangle on a QCanvas.
canvas
This item paints a single rectangle which may have any pen() and brush(), but may not be tilted/rotated. For rotated rectangles, use QCanvasPolygon.
The rectangle's size and initial position can be set in the constructor. The size can be set or changed later using setSize(). Use height() and width() to retrieve the rectangle's dimensions.
The rectangle can be drawn on a painter with drawShape().
Like any other canvas item rectangles can be moved with QCanvasItem::move() and QCanvasItem::moveBy(), or by setting coordinates with QCanvasItem::setX(), QCanvasItem::setY() and QCanvasItem::setZ().
QCanvasRectangle::QCanvasRectangle | ( | QCanvas * | canvas | ) |
Constructs a rectangle at position (0,0) with both width and height set to 32 pixels on canvas.
Constructs a rectangle positioned and sized by r on canvas.
Constructs a rectangle at position (x, y) and size width by height, on canvas.
QCanvasRectangle::~QCanvasRectangle | ( | ) |
Destroys the rectangle.
QCanvasRectangle::QCanvasRectangle | ( | QCanvas * | canvas | ) |
QCanvasRectangle::~QCanvasRectangle | ( | ) |
QPointArray QCanvasRectangle::areaPoints | ( | ) | const [virtual] |
Implementa QCanvasPolygonalItem.
QPointArray QCanvasRectangle::areaPoints | ( | ) | const [virtual] |
This function must be reimplemented by subclasses. It must return the points bounding (i.e. outside and not touching) the shape or drawing errors will occur.
Implementa QCanvasPolygonalItem.
QPointArray QCanvasRectangle::chunks | ( | ) | const [protected, virtual] |
Simply calls QCanvasItem::chunks().
Reimplementado de QCanvasPolygonalItem.
QPointArray QCanvasRectangle::chunks | ( | ) | const [protected, virtual] |
Reimplementado de QCanvasPolygonalItem.
bool QCanvasRectangle::collidesWith | ( | const QCanvasItem * | i | ) | const [virtual] |
Reimplementado de QCanvasPolygonalItem.
bool QCanvasRectangle::collidesWith | ( | const QCanvasItem * | i | ) | const [virtual] |
Reimplementado de QCanvasPolygonalItem.
void QCanvasRectangle::drawShape | ( | QPainter & | p | ) | [protected, virtual] |
Subclasses must reimplement this function to draw their shape. The pen and brush of p are already set to pen() and brush() prior to calling this function.
Implementa QCanvasPolygonalItem.
void QCanvasRectangle::drawShape | ( | QPainter & | p | ) | [protected, virtual] |
Draws the rectangle on painter p.
Implementa QCanvasPolygonalItem.
int QCanvasRectangle::height | ( | ) | const |
Returns the height of the rectangle.
int QCanvasRectangle::height | ( | ) | const |
QRect QCanvasRectangle::rect | ( | ) | const [inline] |
QRect QCanvasRectangle::rect | ( | ) | const [inline] |
int QCanvasRectangle::rtti | ( | ) | const [virtual] |
Returns 2 (QCanvasItem::Rtti_PolygonalItem).
Reimplementado de QCanvasPolygonalItem.
int QCanvasRectangle::rtti | ( | ) | const [virtual] |
Returns 5 (QCanvasItem::Rtti_Rectangle).
Reimplementado de QCanvasPolygonalItem.
Sets the width and height of the rectangle.
QSize QCanvasRectangle::size | ( | ) | const [inline] |
QSize QCanvasRectangle::size | ( | ) | const [inline] |
int QCanvasRectangle::width | ( | ) | const |
Returns the width of the rectangle.
int QCanvasRectangle::width | ( | ) | const |
static int QCanvasRectangle::RTTI = Rtti_Rectangle [static] |
Reimplementado de QCanvasPolygonalItem.