QRegion Class Reference


The QRegion class specified a clip region for the painter. (details) (complete member list)

#include <qregion.h>

Public Members


Detailed Description

The QRegion class specified a clip region for the painter.

A region defines a clip region for a QPainter. A region can be a rectangle, an ellipse, a polygon or a combination of these.

Regions are combined by creating a new region which is a union, intersection or difference between any two regions.

The region XOR operation is defined as:

  a XOR b = (a UNION b) - (a INTERSECTION b)

Example of use:

  QWidget  w;
  QPainter p;
  QRegion r1( QRect(100,100,200,80),    // r1 = elliptic region
              QRegion::Ellipse );
  QRegion r2( QRect(100,120,90,30) );   // r2 = rectangular region
  QRegion r3 = r1.intersect( r2 );      // r3 = intersection
  p.begin( &w );                        // start painting widget
  p.setClipRegion( r3 );                // set clip region
  ...                                   // paint clipped graphics
  p.end();                              // painting done

Member Function Documentation

QRegion::QRegion (const QRect &rr, RegionType t = Rectangle)

Constructs a rectangular or elliptic region.

Arguments:

QRegion::QRegion (const QRegion &r)

Constructs a region which is a shallow copy of r.

QRegion::~QRegion ()

Destroys the region.

bool QRegion::contains (const QPoint &p) const

Returns TRUE if the region contains the point p, or FALSE if p is outside the region.

bool QRegion::contains (const QRect &r) const

Returns TRUE if the region contains the rectangle r, or FALSE if r is outside the region.

QRegion QRegion::copy () const

Returns a deep copy of the region.

QRegion QRegion::intersect (const QRegion &r) const

Returns a region which is the intersection of this region and r.

bool QRegion::isEmpty () const

Returns TRUE if the region is empty, or FALSE if it is non-empty.

bool QRegion::isNull () const

Returns TRUE if the region is a null region.

void QRegion::move (int dx, int dy)

Changes the offset of the region dx along the X axis and dy along the Y axis.

bool QRegion::operator!= (const QRegion &r) const

Returns TRUE if the region is different from r, or FALSE if the regions are equal.

QRegion & QRegion::operator= (const QRegion &r)

Assigns a shallow copy of r to this region and returns a reference to the region.

bool QRegion::operator== (const QRegion &r) const

Returns TRUE if the region is equal to r, or FALSE if the regions are different.

QRegion QRegion::subtract (const QRegion &r) const

Returns a region which is r subtracted from this region.

QRegion QRegion::unite (const QRegion &r) const

Returns a region which is the union of this region and r.

QRegion QRegion::xor (const QRegion &r) const

Returns a region which is this region XOR r.


This file is part of the Qt toolkit, copyright 1995 Troll Tech, all rights reserved.

It was generated from the following files:


Generated at 04:27, 1995/05/20 by the webmaster at Troll Tech