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

Canvas Module

The canvas module provides a highly optimized 2D graphic area called TQCanvas. The canvas can contain an arbitrary number of TQCanvasItems. 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 TQCanvasSprite. (If you require 3D graphics see TQt's OpenGL module.)

The canvas module uses a document/view model. The TQCanvasView 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.

Screenshot of a canvas

TQt provides a number of predefined TQCanvas items as listed below.

The two classes TQCanvasPixmap and TQCanvasPixmapArray are used by TQCanvasSprite 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 TQCanvasItem's derived classes (usually TQCanvasPolygonalItem) rather than inherit TQCanvasItem directly.

See examples/canvas for an example that shows off some of TQCanvas's capabilities.


Copyright © 2007 TrolltechTrademarks
TQt 3.3.8