Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions

TQCanvasRectangle Class Reference
[canvas module]

The TQCanvasRectangle class provides a rectangle on a TQCanvas. More...

#include <tqcanvas.h>

Inherits TQCanvasPolygonalItem.

List of all member functions.

Public Members

Protected Members


Detailed Description

The TQCanvasRectangle class provides a rectangle on a TQCanvas.

This item paints a single rectangle which may have any pen() and brush(), but may not be tilted/rotated. For rotated rectangles, use TQCanvasPolygon.

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 TQCanvasItem::move() and TQCanvasItem::moveBy(), or by setting coordinates with TQCanvasItem::setX(), TQCanvasItem::setY() and TQCanvasItem::setZ().

See also Graphics Classes and Image Processing Classes.


Member Function Documentation

TQCanvasRectangle::TQCanvasRectangle ( TQCanvas * canvas )

Constructs a rectangle at position (0,0) with both width and height set to 32 pixels on canvas.

TQCanvasRectangle::TQCanvasRectangle ( const TQRect & r, TQCanvas * canvas )

Constructs a rectangle positioned and sized by r on canvas.

TQCanvasRectangle::TQCanvasRectangle ( int x, int y, int width, int height, TQCanvas * canvas )

Constructs a rectangle at position (x, y) and size width by height, on canvas.

TQCanvasRectangle::~TQCanvasRectangle ()

Destroys the rectangle.

TQPointArray TQCanvasRectangle::chunks () const [virtual protected]

Simply calls TQCanvasItem::chunks().

void TQCanvasRectangle::drawShape ( TQPainter & p ) [virtual protected]

Draws the rectangle on painter p.

Example: canvas/canvas.cpp.

Reimplemented from TQCanvasPolygonalItem.

int TQCanvasRectangle::height () const

Returns the height of the rectangle.

TQRect TQCanvasRectangle::rect () const

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

int TQCanvasRectangle::rtti () const [virtual]

Returns 5 (TQCanvasItem::Rtti_Rectangle).

See also TQCanvasItem::rtti().

Reimplemented from TQCanvasPolygonalItem.

void TQCanvasRectangle::setSize ( int width, int height )

Sets the width and height of the rectangle.

TQSize TQCanvasRectangle::size () const

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

See also rect() and setSize().

int TQCanvasRectangle::width () const

Returns the width of the rectangle.

This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.


Copyright © 2007 TrolltechTrademarks
TQt 3.3.8