![]() |
| ||
Classes - Annotated - Tree - Functions - Home - Structure |
The QCanvasView class provides an on-screen view of a QCanvas. More...
#include <qcanvas.h>
Inherits QScrollView.
A QCanvasView is widget which provides a view of a QCanvas.
If you want users to be able to interact with a canvas view, subclass QCanvasView. You might then reimplement QScrollView::contentsMousePressEvent() for example:
void MyCanvasView::contentsMousePressEvent( QMouseEvent* e ) { QCanvasItemList l = canvas()->collisions(e->pos()); for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) { if ( (*it)->rtti() == QCanvasItem::Rtti_Rectangle ) qDebug("A QCanvasRectangle lies somewhere at this point"); } }
Set the canvas that the view shows with setCanvas() and retrieve the canvas which the view is showing with canvas().
A transformation matrix can be used to transform the view of the canvas in various ways, for example, zooming in or out or rotating. For example:
QWMatrix wm; wm.scale( 2, 2 ); // Zooms in by 2 times wm.rotate( 90 ); // Rotates 90 degrees clockwise myCanvasView->setWorldMatrix( wm );
Use setWorldMatrix() to set the canvas view's world matrix: you must ensure that the world matrix is invertible. The current world matrix is retrievable with worldMatrix(), and its inversion is retrievable with inverseWorldMatrix().
See also QWMatrix and QPainter::setWorldMatrix().
Constructs a QCanvasView which views canvas canvas, with parent parent, and name name, using the widget flags f.
Returns a pointer to the canvas which the QCanvasView is currently showing.
Reimplemented from QScrollView.
See also setWorldMatrix() and worldMatrix().
When you use this, you should note that the performance of the QCanvasView will decrease considerably.
Returns FALSE in case wm is not invertable; otherwise returns TRUE.
See also worldMatrix(), inverseWorldMatrix() and QWMatrix::invertible().
See also setWorldMatrix() and inverseWordMatrix().
Search the documentation, FAQ, qt-interest archive and more (uses
www.trolltech.com):
This file is part of the Qt toolkit, copyright © 1995-2001 Trolltech, all rights reserved.
Copyright © 2001 Trolltech | Trademarks | Qt version 3.0.0-beta1-beta1
|