Qyoto  4.0.7
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties
QtGui.QPolygon Class Reference

The QPolygon class provides a vector of points using integer precision. More...

Inheritance diagram for QtGui.QPolygon:
Collaboration diagram for QtGui.QPolygon:

Public Member Functions

 QPolygon ()
  More...
 
 QPolygon (QPolygon a)
  More...
 
 QPolygon (QRect r, bool closed=false)
  More...
 
 QPolygon (int size)
  More...
 
 QPolygon (int nPoints, ref int points)
 
 QPolygon (System.Collections.Generic.List< QPoint > v)
  More...
 
virtual void CreateProxy ()
 
new bool ContainsPoint (QPoint pt, Qt.FillRule fillRule)
  More...
 
new QPolygon Intersected (QPolygon r)
  More...
 
new QPoint Point (int i)
  More...
 
new void Point (int i, ref int x, ref int y)
  More...
 
new void PutPoints (int index, int nPoints, QPolygon from, int fromIndex=0)
  More...
 
new void PutPoints (int index, int nPoints, ref int points)
 
new void SetPoint (int index, QPoint p)
  More...
 
new void SetPoint (int index, int x, int y)
  More...
 
new void SetPoints (int nPoints, ref int points)
  More...
 
new QPolygon Subtracted (QPolygon r)
  More...
 
new void Swap (QPolygon other)
  More...
 
new void Translate (QPoint offset)
  More...
 
new void Translate (int dx, int dy)
  More...
 
new QPolygon Translated (QPoint offset)
  More...
 
new QPolygon Translated (int dx, int dy)
  More...
 
new QPolygon United (QPolygon r)
  More...
 
new void Dispose ()
 

Static Public Member Functions

static QPolygon operator* (QPolygon a, QMatrix m)
  More...
 
static QPolygon operator* (QPolygon a, QTransform m)
  More...
 

Protected Member Functions

 QPolygon (System.Type dummy)
 

Protected Attributes

SmokeInvocation interceptor
 

Properties

QRect BoundingRect [get]
  More...
 
virtual System.IntPtr SmokeObject [get, set]
 

Detailed Description

The QPolygon class provides a vector of points using integer precision.

A QPolygon object is a QVector<QPoint>. The easiest way to add points to a QPolygon is to use QVector's streaming operator, as illustrated below:

QPolygon polygon;

polygon << QPoint(10, 20) << QPoint(20, 30);

In addition to the functions provided by QVector, QPolygon provides some point-specific functions.

Each point in a polygon can be retrieved by passing its index to the point() function. To populate the polygon, QPolygon provides the setPoint() function to set the point at a given index, the setPoints() function to set all the points in the polygon (resizing it to the given number of points), and the putPoints() function which copies a number of given points into the polygon from a specified index (resizing the polygon if necessary).

QPolygon provides the boundingRect() and translate() functions for geometry functions. Use the QMatrix::map() function for more general transformations of QPolygons.

The QPolygon class is implicitly shared.

See also QVector, QPolygonF, and QLine.

Constructor & Destructor Documentation

QtGui.QPolygon.QPolygon ( System.Type  dummy)
protected
QtGui.QPolygon.QPolygon ( )

Constructs a polygon with no points.

See also QVector::isEmpty().

Here is the call graph for this function:

QtGui.QPolygon.QPolygon ( QPolygon  a)

Constructs a copy of the given polygon.

See also setPoints().

Here is the call graph for this function:

QtGui.QPolygon.QPolygon ( QRect  r,
bool  closed = false 
)

Constructs a polygon from the given rectangle. If closed is false, the polygon just contains the four points of the rectangle ordered clockwise, otherwise the polygon's fifth point is set to rectangle.topLeft().

Note that the bottom-right corner of the rectangle is located at (rectangle.x() + rectangle.width(), rectangle.y() + rectangle.height()).

See also setPoints().

Here is the call graph for this function:

QtGui.QPolygon.QPolygon ( int  size)

Constructs a polygon of the given size. Creates an empty polygon if size == 0.

See also QVector::isEmpty().

Here is the call graph for this function:

QtGui.QPolygon.QPolygon ( int  nPoints,
ref int  points 
)

Here is the call graph for this function:

QtGui.QPolygon.QPolygon ( System.Collections.Generic.List< QPoint v)

Constructs a polygon containing the specified points.

See also setPoints().

Here is the call graph for this function:

Member Function Documentation

new bool QtGui.QPolygon.ContainsPoint ( QPoint  pt,
Qt.FillRule  fillRule 
)

Returns true if the given point is inside the polygon according to the specified fillRule; otherwise returns false.

This function was introduced in Qt 4.3.

virtual void QtGui.QPolygon.CreateProxy ( )
virtual

Here is the caller graph for this function:

new void QtGui.QPolygon.Dispose ( )
new QPolygon QtGui.QPolygon.Intersected ( QPolygon  r)

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

Set operations on polygons will treat the polygons as areas. Non-closed polygons will be treated as implicitly closed.

This function was introduced in Qt 4.3.

static QPolygon QtGui.QPolygon.operator* ( QPolygon  a,
QMatrix  m 
)
static

This is the same as matrix.map(polygon).

See also QMatrix::map().

static QPolygon QtGui.QPolygon.operator* ( QPolygon  a,
QTransform  m 
)
static

This is the same as matrix.map(polygon).

See also QTransform::map().

new QPoint QtGui.QPolygon.Point ( int  i)

This is an overloaded function.

Returns the point at the given index.

new void QtGui.QPolygon.Point ( int  i,
ref int  x,
ref int  y 
)

Extracts the coordinates of the point at the given index to *x and *y (if they are valid pointers).

See also setPoint().

new void QtGui.QPolygon.PutPoints ( int  index,
int  nPoints,
QPolygon  from,
int  fromIndex = 0 
)

This is an overloaded function.

Copies nPoints points from the given fromIndex ( 0 by default) in fromPolygon into this polygon, starting at the specified index. For example:

QPolygon polygon1;

polygon1.putPoints(0, 3, 1,2, 0,0, 5,6);

// polygon1 is now the three-point polygon(1,2, 0,0, 5,6);

QPolygon polygon2;

polygon2.putPoints(0, 3, 4,4, 5,5, 6,6);

// polygon2 is now (4,4, 5,5, 6,6);

polygon1.putPoints(2, 3, polygon2);

// polygon1 is now the five-point polygon(1,2, 0,0, 4,4, 5,5, 6,6);

new void QtGui.QPolygon.PutPoints ( int  index,
int  nPoints,
ref int  points 
)
new void QtGui.QPolygon.SetPoint ( int  index,
QPoint  p 
)

This is an overloaded function.

Sets the point at the given index to the given point.

new void QtGui.QPolygon.SetPoint ( int  index,
int  x,
int  y 
)

Sets the point at the given index to the point specified by (x, y).

See also point(), putPoints(), and setPoints().

new void QtGui.QPolygon.SetPoints ( int  nPoints,
ref int  points 
)

Resizes the polygon to nPoints and populates it with the given points.

The example code creates a polygon with two points (10, 20) and (30, 40):

static const int points[] = { 10, 20, 30, 40 };

QPolygon polygon;

polygon.setPoints(2, points);

See also setPoint() and putPoints().

new QPolygon QtGui.QPolygon.Subtracted ( QPolygon  r)

Returns a polygon which is r subtracted from this polygon.

Set operations on polygons will treat the polygons as areas. Non-closed polygons will be treated as implicitly closed.

This function was introduced in Qt 4.3.

new void QtGui.QPolygon.Swap ( QPolygon  other)

Swaps polygon other with this polygon. This operation is very fast and never fails.

This function was introduced in Qt 4.8.

new void QtGui.QPolygon.Translate ( QPoint  offset)

This is an overloaded function.

Translates all points in the polygon by the given offset.

See also translated().

new void QtGui.QPolygon.Translate ( int  dx,
int  dy 
)

Translates all points in the polygon by (dx, dy).

See also translated().

new QPolygon QtGui.QPolygon.Translated ( QPoint  offset)

This is an overloaded function.

Returns a copy of the polygon that is translated by the given offset.

This function was introduced in Qt 4.6.

See also translate().

new QPolygon QtGui.QPolygon.Translated ( int  dx,
int  dy 
)

Returns a copy of the polygon that is translated by (dx, dy).

This function was introduced in Qt 4.6.

See also translate().

new QPolygon QtGui.QPolygon.United ( QPolygon  r)

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

Set operations on polygons, will treat the polygons as areas, and implicitly close the polygon.

This function was introduced in Qt 4.3.

See also intersected() and subtracted().

Member Data Documentation

SmokeInvocation QtGui.QPolygon.interceptor
protected

Property Documentation

QRect QtGui.QPolygon.BoundingRect
get

Returns the bounding rectangle of the polygon, or QRect(0, 0, 0, 0) if the polygon is empty.

See also QVector::isEmpty().

virtual System.IntPtr QtGui.QPolygon.SmokeObject
getset