The QPointArray class provides an array of points. More...
#include <qpntarry.h>
Inherits QArray.
QPointArray is used by the QPainter to draw line segments, polylines, polygons and Bezier curves.
The QPointArray is not an array of QPoint, instead it contains a platform dependent point type to make the QPainter functions more efficient (no conversion needed). On the other hand, QPointArray has member functions that operate on QPoint to make programming easier.
Note that since this class is a QArray, it is explicitly shared and works with shallow copies by default.
Examples: xshape/xshape.cpp picture/makepic.cpp drawdemo/drawdemo.cpp aclock/aclock.cpp
Constructs a point array from the rectangle r.
If closed is FALSE, then the point array will contain the following four points (in the listed order):
If closed is TRUE, then a fifth point is set to r.topLeft() to close the point array.
Constructs a shallow copy of the point array a.
Constructs a point array with nPoints points, taken from the points array.
Equivalent to setPoints(nPoints,points).
Constructs a point array with room for size points. Makes a null array if size == 0.
See also: resize() and isNull().
Constructs a null point array.
See also: isNull().
Returns the point at position index in the array.
See also: operator[].
Returns the bounding rectangle of the points in the array, or QRect(0,0,0,0) if the array is empty.
Fills the point array with the point p. If size is specified as different from -1, then the array will be resized before filled.
Returns TRUE if successful, or FALSE if the memory cannot be allocated (only when size != -1).
See also: resize().
Assigns a shallow copy of a to this point array and returns a reference to this point array.
Equivalent to assign( a ).
Returns the point at position index in the array.
Returns the point at position index in the array in *x and *y.
Examples: drawdemo/drawdemo.cpp
Copies nPoints points from the points array into this point array.
Will resize this point array if index+nPoints
exceeds
the size of the array.
Returns TRUE if successful, or FALSE if the array could not be resized.
Example:
QPointArray a( 1 ); a[0] = QPoint( 1, 2 ); static QCOORD points[] = { 3,4, 5,6 }; a.putPoints( 1, 2, points );
The example code creates an array with two points (1,2), (3,4) and (5,6).
This function differs from setPoints() because it does not resize the array unless the array size is exceeded.
See also: resize() and setPoints().
Copies nPoints points from the variable argument list into this point
array. Will resize this point array if index+nPoints
exceeds
the size of the array.
Returns TRUE if successful, or FALSE if the array could not be resized.
Example:
QPointArray a( 1 ); a[0] = QPoint( 1, 2 ); a.putPoints( 1, 2, 3,4, 5,6 );
The example code creates an array with two points (1,2), (3,4) and (5,6).
This function differs from setPoints() because it does not resize the array unless the array size is exceeded.
See also: resize() and setPoints().
Returns the Bezier points for the four control points in this array.
Examples: drawdemo/drawdemo.cpp
Sets the point at position index in the array to (x,y).
Examples: drawdemo/drawdemo.cpp
Resizes the array to nPoints and sets the points in the array to the values taken from points.
Returns TRUE if successful, or FALSE if the array could not be resized.
Example:
static QCOORD points[] = { 1,2, 3,4 }; QPointArray a; a.setPoints( 2, points );
The example code creates an array with two points (1,2) and (3,4).
See also: resize() and putPoints().
Examples: aclock/aclock.cpp
Resizes the array to nPoints and sets the points in the array to the values taken from the variable argument list.
Returns TRUE if successful, or FALSE if the array could not be resized.
Example:
QPointArray a; a.setPoints( 2, 1,2, 3,4 );
The example code creates an array with two points (1,2) and (3,4).
See also: resize() and putPoints().
Translates all points in the array (dx,dy).
Writes a point array to the stream and returns a reference to the stream.
The serialization format is:
Reads a point array from the stream and returns a reference to the stream.
This file is part of the Qt toolkit, copyright © 1995-96 Troll Tech, all rights reserved.
It was generated from the following files: