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

# Canvas Module

This module is part of the Qt Enterprise Edition.

The canvas module provides a highly optimized 2D graphic area called QCanvas. The canvas can contain an arbitrary number of QCanvasItems. Canvas items can have an arbitrary shape, size and content, can be freely moved around in the canvas, and can be checked for collisions. Canvas items can be set to move across the canvas automatically and animated canvas items are supported with QCanvasSprite. (If you require 3D graphics see Qt's OpenGL module.)

The canvas module uses a document/view model. The QCanvasView class is used to show a particular view of a canvas. Multiple views can operate on the same canvas at the same time. Every view can use an arbitrary transformation matrix on the canvas which makes it easy to implement features such as zooming.

Qt provides a number of predefined QCanvas items as listed below.

- QCanvasItem -- An abstract base class for all canvas items.
- QCanvasEllipse -- An ellipse or "pie segment".
- QCanvasLine -- A line segment.
- QCanvasPolygon -- A polygon.
- QCanvasPolygonalItem -- A base class for items that have a non-rectangular shape. Most canvas items derive from this class.
- QCanvasRectangle -- A rectangle. The rectangle cannot be tilted or rotated. Rotated rectangles can be drawn using QCanvasPolygon.
- QCanvasSpline -- A multi-bezier spline.
- QCanvasSprite -- An animated pixmap.
- QCanvasText -- A text string.

The two classes QCanvasPixmap and QCanvasPixmapArray are used by QCanvasSprite to show animated and moving pixmaps on the canvas.

More specialized items can be created by inheriting from one of the canvas item classes. It is easiest to inherit from one of QCanvasItem's derived classes (usually QCanvasPolygonalItem) rather than inherit QCanvasItem directly.