| Classes - Annotated - Tree - Functions - Home - Structure

# QCanvasRectangle Class Reference
[ canvas module ]

A rectangle with a movable top-left point. More...

`#include <qcanvas.h>`

Inherits QCanvasPolygonalItem.

List of all member functions.

## Public Members

- 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
- QRect rect () const
- virtual int rtti () const

## Protected Members

- virtual void drawShape ( QPainter & )
- QPointArray chunks () const

## Detailed Description

A rectangle with a movable top-left point.

Paints a rectangle in a QBrush and QPen.

## Member Function Documentation

### QCanvasRectangle::QCanvasRectangle ( QCanvas * canvas )

Constructs a rectangle (0,0,32,32) on canvas.

### QCanvasRectangle::QCanvasRectangle ( const QRect & r, QCanvas * canvas )

Constructs a rectangle positioned and sized by r on canvas.

### QCanvasRectangle::QCanvasRectangle ( int x, int y, int width, int height, QCanvas * canvas )

Constructs a rectangle with position x, y and size width by height, on canvas.

### QCanvasRectangle::~QCanvasRectangle ()

Destructs the rectangle.

### QPointArray QCanvasRectangle::areaPoints () const `[virtual]`

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QCanvasPolygonalItem.

### bool QCanvasRectangle::collidesWith ( const QCanvasItem * i ) const `[virtual]`

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QCanvasItem.

### void QCanvasRectangle::drawShape ( QPainter & p ) `[virtual protected]`

Draws the rectangle on p.

Reimplemented from QCanvasPolygonalItem.

### int QCanvasRectangle::height () const

Returns the height of the rectangle.

### QRect QCanvasRectangle::rect () const

Returns the integer-converted x(), y() position and size() of the rectangle as a QRect.

### int QCanvasRectangle::rtti () const `[virtual]`

Returns 5.

See also QCanvasItem::rtti().

Reimplemented from QCanvasItem.

### void QCanvasRectangle::setSize ( int width, int height )

Sets the width and height of the rectangle.

### QSize QCanvasRectangle::size () const

Returns the width() and height() of the rectangle.

See also rect() and setSize().

### int QCanvasRectangle::width () const

Returns the width of the rectangle.

Search the documentation, FAQ, qt-interest archive and more (uses www.trolltech.com):

This file is part of the Qt toolkit, copyright © 1995-2000 Trolltech, all rights reserved.