HomeHome

ClassesAnnotated - TreeFunctionsHomeStructure

QCanvasView Class Reference
[ canvas module ]


A QWidget which views a QCanvas. More...

#include <qcanvas.h>

Inherits QScrollView.

List of all member functions.

Public Members

Protected Members


Detailed Description

A QWidget which views a QCanvas.

Displays a view of a QCanvas, with scrollbars available if desired. There can be more than one view of a canvas.

The view of a canvas is the object which the user can see and interact with, hence any interactivity will be based on events from a view. For example, by subclassing QCanvasView and overriding QScrollView::contentsMousePressEvent(), an application can provide a canvas where the user can interact with items on the canvas.

  void MyCanvasView::contentsMousePressEvent(QMouseEvent* e)
  {
      QCanvasItemList list = canvas()->collisions(e->pos());
      if ( !list.isEmpty() ) {
          QCanvasItem* item = list.first();

          // Process the top item
          ...
      }
  }

Most of the functionality of QCanvasView is the functionality available for all QScrollView subclasses.


Member Function Documentation

QCanvasView::QCanvasView ( QCanvas * canvas=0, QWidget * parent=0, const char * name=0, WFlags f=0 )

Constructs a QCanvasView which views canvas. The usual QWidget parameters may also be supplied.

QCanvasView::~QCanvasView ()

Destructs the view. The associated canvas is not deleted.

QCanvasQCanvasView::canvas () const

Returns the canvas which the view is currently viewing.

void QCanvasView::drawContents ( QPainter * p, int cx, int cy, int cw, int ch ) [virtual protected]

Repaints the appropriate area of the QCanvas which this QCanvasView is viewing.

Reimplemented from QScrollView.

void QCanvasView::setCanvas ( QCanvas * canvas )

Changes the QCanvas which the QCanvasView is viewing to canvas.

QSize QCanvasView::sizeHint () const [virtual protected]

Suggests a size sufficient to view the entire canvas.

Reimplemented from QWidget.


Search the documentation, FAQ, qt-interest archive and more (uses www.trolltech.com):


This file is part of the Qt toolkit, copyright © 1995-2000 Trolltech, all rights reserved.


Copyright © 2000 TrolltechTrademarks
Qt version 2.2.1