summaryrefslogtreecommitdiffstats
path: root/doc/man/man3/qcanvasview.3qt
diff options
context:
space:
mode:
Diffstat (limited to 'doc/man/man3/qcanvasview.3qt')
-rw-r--r--doc/man/man3/qcanvasview.3qt188
1 files changed, 188 insertions, 0 deletions
diff --git a/doc/man/man3/qcanvasview.3qt b/doc/man/man3/qcanvasview.3qt
new file mode 100644
index 000000000..709266399
--- /dev/null
+++ b/doc/man/man3/qcanvasview.3qt
@@ -0,0 +1,188 @@
+'\" t
+.TH QCanvasView 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
+.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
+.\" license file included in the distribution for a complete license
+.\" statement.
+.\"
+.ad l
+.nh
+.SH NAME
+QCanvasView \- On-screen view of a QCanvas
+.SH SYNOPSIS
+\fC#include <qcanvas.h>\fR
+.PP
+Inherits QScrollView.
+.PP
+.SS "Public Members"
+.in +1c
+.ti -1c
+.BI "\fBQCanvasView\fR ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )"
+.br
+.ti -1c
+.BI "\fBQCanvasView\fR ( QCanvas * canvas, QWidget * parent = 0, const char * name = 0, WFlags f = 0 )"
+.br
+.ti -1c
+.BI "\fB~QCanvasView\fR ()"
+.br
+.ti -1c
+.BI "QCanvas * \fBcanvas\fR () const"
+.br
+.ti -1c
+.BI "void \fBsetCanvas\fR ( QCanvas * canvas )"
+.br
+.ti -1c
+.BI "const QWMatrix & \fBworldMatrix\fR () const"
+.br
+.ti -1c
+.BI "const QWMatrix & \fBinverseWorldMatrix\fR () const"
+.br
+.ti -1c
+.BI "bool \fBsetWorldMatrix\fR ( const QWMatrix & wm )"
+.br
+.in -1c
+.SS "Protected Members"
+.in +1c
+.ti -1c
+.BI "virtual void \fBdrawContents\fR ( QPainter * p, int cx, int cy, int cw, int ch )"
+.br
+.ti -1c
+.BI "virtual QSize \fBsizeHint\fR () const"
+.br
+.in -1c
+.SH DESCRIPTION
+The QCanvasView class provides an on-screen view of a QCanvas.
+.PP
+A QCanvasView is widget which provides a view of a QCanvas.
+.PP
+If you want users to be able to interact with a canvas view, subclass QCanvasView. You might then reimplement QScrollView::contentsMousePressEvent(). For example, assuming no transformation matrix is set:
+.PP
+.nf
+.br
+ void MyCanvasView::contentsMousePressEvent( QMouseEvent* e )
+.br
+ {
+.br
+ QCanvasItemList l = canvas()->collisions(e->pos());
+.br
+ for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) {
+.br
+ if ( (*it)->rtti() == QCanvasRectangle::RTTI )
+.br
+ qDebug("A QCanvasRectangle lies somewhere at this point");
+.br
+ }
+.br
+ }
+.br
+.fi
+.PP
+The canvas view shows canvas canvas(); this can be changed using setCanvas().
+.PP
+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:
+.PP
+.nf
+.br
+ QWMatrix wm;
+.br
+ wm.scale( 2, 2 ); // Zooms in by 2 times
+.br
+ wm.rotate( 90 ); // Rotates 90 degrees counter clockwise
+.br
+ // around the origin.
+.br
+ wm.translate( 0, -canvas->height() );
+.br
+ // moves the canvas down so what was visible
+.br
+ // before is still visible.
+.br
+ myCanvasView->setWorldMatrix( wm );
+.br
+.fi
+.PP
+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().
+.PP
+Example:
+.PP
+The following code finds the part of the canvas that is visible in this view, i.e. the bounding rectangle of the view in canvas coordinates.
+.PP
+.nf
+.br
+ QRect rc = QRect( myCanvasView->contentsX(), myCanvasView->contentsY(),
+.br
+ myCanvasView->visibleWidth(), myCanvasView->visibleHeight() );
+.br
+ QRect canvasRect = myCanvasView->inverseWorldMatrix().mapRect(rc);
+.br
+.fi
+.PP
+See also QWMatrix, QPainter::setWorldMatrix(), Graphics Classes, and Image Processing Classes.
+.PP
+.SH MEMBER FUNCTION DOCUMENTATION
+.SH "QCanvasView::QCanvasView ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )"
+Constructs a QCanvasView with parent \fIparent\fR, and name \fIname\fR, using the widget flags \fIf\fR. The canvas view is not associated with a canvas, so you must to call setCanvas() to view a canvas.
+.SH "QCanvasView::QCanvasView ( QCanvas * canvas, QWidget * parent = 0, const char * name = 0, WFlags f = 0 )"
+This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
+.PP
+Constructs a QCanvasView which views canvas \fIcanvas\fR, with parent \fIparent\fR, and name \fIname\fR, using the widget flags \fIf\fR.
+.SH "QCanvasView::~QCanvasView ()"
+Destroys the canvas view. The associated canvas is \fInot\fR deleted.
+.SH "QCanvas * QCanvasView::canvas () const"
+Returns a pointer to the canvas which the QCanvasView is currently showing.
+.SH "void QCanvasView::drawContents ( QPainter * p, int cx, int cy, int cw, int ch )\fC [virtual protected]\fR"
+Repaints part of the QCanvas that the canvas view is showing starting at \fIcx\fR by \fIcy\fR, with a width of \fIcw\fR and a height of \fIch\fR using the painter \fIp\fR.
+.PP
+\fBWarning:\fR When double buffering is enabled, drawContents() will not respect the current settings of the painter when setting up the painter for the double buffer (e.g., viewport() and window()). Also, be aware that QCanvas::update() bypasses drawContents(), which means any reimplementation of drawContents() is not called.
+.PP
+See also QCanvas::setDoubleBuffering().
+.PP
+Reimplemented from QScrollView.
+.SH "const QWMatrix & QCanvasView::inverseWorldMatrix () const"
+Returns a reference to the inverse of the canvas view's current transformation matrix.
+.PP
+See also setWorldMatrix() and worldMatrix().
+.SH "void QCanvasView::setCanvas ( QCanvas * canvas )"
+Sets the canvas that the QCanvasView is showing to the canvas \fIcanvas\fR.
+.SH "bool QCanvasView::setWorldMatrix ( const QWMatrix & wm )"
+Sets the transformation matrix of the QCanvasView to \fIwm\fR. The matrix must be invertible (i.e. if you create a world matrix that zooms out by 2 times, then the inverse of this matrix is one that will zoom in by 2 times).
+.PP
+When you use this, you should note that the performance of the QCanvasView will decrease considerably.
+.PP
+Returns FALSE if \fIwm\fR is not invertable; otherwise returns TRUE.
+.PP
+See also worldMatrix(), inverseWorldMatrix(), and QWMatrix::isInvertible().
+.PP
+Example: canvas/canvas.cpp.
+.SH "QSize QCanvasView::sizeHint () const\fC [virtual protected]\fR"
+Suggests a size sufficient to view the entire canvas.
+.SH "const QWMatrix & QCanvasView::worldMatrix () const"
+Returns a reference to the canvas view's current transformation matrix.
+.PP
+See also setWorldMatrix() and inverseWorldMatrix().
+.PP
+Example: canvas/canvas.cpp.
+
+.SH "SEE ALSO"
+.BR http://doc.trolltech.com/qcanvasview.html
+.BR http://www.trolltech.com/faq/tech.html
+.SH COPYRIGHT
+Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
+license file included in the distribution for a complete license
+statement.
+.SH AUTHOR
+Generated automatically from the source code.
+.SH BUGS
+If you find a bug in Qt, please report it as described in
+.BR http://doc.trolltech.com/bughowto.html .
+Good bug reports help us to help you. Thank you.
+.P
+The definitive Qt documentation is provided in HTML format; it is
+located at $QTDIR/doc/html and can be read using Qt Assistant or with
+a web browser. This man page is provided as a convenience for those
+users who prefer man pages, although this format is not officially
+supported by Trolltech.
+.P
+If you find errors in this manual page, please report them to
+Please include the name of the manual page (qcanvasview.3qt) and the Qt
+version (3.3.8).