QPointArray(3qt)
β¨ QPointArray β¨
okay bestie, welcome to the <pink>QPointArray(3qt)</pink> man page, she's an icon, she's from the Qt 3 era, and she's literally just a whole array of points π
let's get into it
π NAME π
QPointArray β Array of points. that's it. that's the vibe. a whole glow-up array of points π¦
πΈ SYNOPSIS πΈ
#include <qpointarray.h>
Inherits QMemArray<QPoint>.
π Public Members π
QPointArray ()
~QPointArray ()
QPointArray ( int size )
QPointArray ( const QPointArray & a )
QPointArray ( const QRect & r, bool closed = FALSE )
QPointArray & operator= ( const QPointArray & a )
QPointArray copy () const
void translate ( int dx, int dy )
QRect boundingRect () const
void point ( uint index, int * x, int * y ) const
QPoint point ( uint index ) const
void setPoint ( uint index, int x, int y )
void setPoint ( uint i, const QPoint & p )
bool putPoints ( int index, int nPoints, int firstx, int firsty, ... )
bool putPoints ( int index, int nPoints, const QPointArray & from, int
fromIndex = 0 )
void makeArc ( int x, int y, int w, int h, int a1, int a2 )
void makeEllipse ( int x, int y, int w, int h )
void makeArc ( int x, int y, int w, int h, int a1, int a2, const
QWMatrix & xf )
QPointArray cubicBezier () const
π« RELATED FUNCTION DOCUMENTATION π«
(these two live in the synopsis too, they're just extra like that)
QDataStream & operator<< ( QDataStream & s, const QPointArray & a )
QDataStream & operator>> ( QDataStream & s, QPointArray & a )
π DESCRIPTION π
so. the QPointArray class provides an array of points. groundbreaking, i know, but stay with me π«Ά
a QPointArray is literally an array of QPoint objects. on top of everything QMemArray already gives you, QPointArray brings some point-specific functions to the table. she's QMemArray but with a pointy little personality π
when you wanna read and write your point data the easy way, you're gonna reach for setPoints(), putPoints(), point(), and setPoint(). those are the girlies for the job β¨
for geometry stuff you got boundingRect() and translate(). and if you need more general transformations of your QPointArrays, there's the QWMatrix::map() function waiting for you. you can also cook up arcs and ellipses with makeArc() and makeEllipse() π
among others (iykyk), QPointArray gets used by QPainter::drawLineSegments(), QPainter::drawPolyline(), QPainter::drawPolygon() and QPainter::drawCubicBezier(). she's booked and busy π
β οΈ MAJOR CAVEAT BESTIE β οΈ because this class is aQMemArray, copying an array and then modifying the copy modifies the original too. that's a shallow copy, no cap. if you need a deep copy, usecopy()ordetach(), like so:
void drawGiraffe( const QPointArray & r, QPainter * p )
{
QPointArray tmp = r;
tmp.detach();
// some code that modifies tmp
p->drawPoints( tmp );
}
and if you forget the tmp.detach(), the const array gets modified. yes really. the const one. π tragic behavior fr fr
See also: QPainter, QWMatrix, QMemArray, Graphics Classes, Image Processing Classes, and Implicitly and Explicitly Shared Classes. πΈ
π¦ MEMBER FUNCTION DOCUMENTATION π¦
QPointArray::QPointArray ()
constructs a null point array. that's it, she's null, she's fresh out the box π
See also: isNull().
QPointArray::QPointArray ( int size )
constructs a point array with room for size points. and if size == 0, you get a null array instead. okay!
See also: resize() and isNull().
QPointArray::QPointArray ( const QPointArray & a )
constructs a shallow copy of the point array a. remember the shallow copy drama from up top, bestie, it applies here π
See also: copy() and detach().
QPointArray::QPointArray ( const QRect & r, bool closed = FALSE )
constructs a point array out of the rectangle r. β¨
if closed is FALSE, then the point array just contains these four points, in exactly this order: r.topLeft(), r.topRight(), r.bottomRight() and r.bottomLeft().
if closed is TRUE, then a fifth point gets set to r.topLeft(). so she closes the loop, periodt π
QPointArray::~QPointArray ()
destroys the point array. rip queen, you served π«‘
QRect QPointArray::boundingRect () const
returns the bounding rectangle of the points in the array. and if the array is empty? you get QRect(0,0,0,0). that's the answer, don't @ me.
QPointArray QPointArray::copy () const
creates a deep copy of the array. the real one. the one that doesn't share its soul with the original π¦
See also: detach().
QPointArray QPointArray::cubicBezier () const
returns the Bezier points for the four control points in this array. four points in, bezier out, iconic behavior β
void QPointArray::makeArc ( int x, int y, int w, int h, int a1, int a2 )
sets the points of the array to the ones describing an arc of an ellipse with size, width w by height h, and position (x, y), starting from angle a1 and spanning by angle a2. the resulting array has sufficient resolution for pixel accuracy (see the overloaded function that takes an extra QWMatrix parameter, she's down below π).
angles are specified in 16ths of a degree, i.e. a full circle equals 5760 (16*360). positive values mean counter-clockwise, while negative values mean the clockwise direction. zero degrees is at the 3 o'clock position. clock it π
See the angle diagram.
void QPointArray::makeArc ( int x, int y, int w, int h, int a1, int a2, const QWMatrix & xf )
this is an overloaded member function, provided for convenience. it behaves essentially like the above function. (that's the whole point of her, she's the glow-up version β¨)
sets the points of the array to the ones describing an arc of an ellipse with width w and height h and position (x, y), starting from angle a1, and spanning angle by a2, and transformed by the matrix xf. the resulting array has sufficient resolution for pixel accuracy. π₯
angles are specified in 16ths of a degree, i.e. a full circle equals 5760 (16*360). positive values mean counter-clockwise, while negative values mean the clockwise direction. zero degrees is at the 3 o'clock position.
See the angle diagram.
void QPointArray::makeEllipse ( int x, int y, int w, int h )
sets the points of the array to the ones describing an ellipse with size, width w by height h, and position (x, y). π₯β¨
the returned array has sufficient resolution for use as pixels. pixel perfect, we love to see it π
QPointArray & QPointArray::operator= ( const QPointArray & a )
assigns a shallow copy of a to this point array, and returns a reference to this point array. yes, shallow again. it's giving sharing-is-caring but also chaos π
equivalent to assign(a).
See also: copy() and detach().
void QPointArray::point ( uint index, int * x, int * y ) const
reads the coordinates of the point at position index within the array and writes them into *x and *y. two ints out the door, no cap π
QPoint QPointArray::point ( uint index ) const
this is an overloaded member function, provided for convenience. it behaves essentially like the above function.
returns the point at position index within the array. just the point. that's her π¦
bool QPointArray::putPoints ( int index, int nPoints, int firstx, int firsty, ... )
copies nPoints points from the variable argument list into this point array from position index, and resizes the point array if index+nPoints exceeds the size of the array.
returns TRUE if successful, or FALSE if the array could not be resized (typically due to lack of memory). π
this example code creates an array with three points (4,5), (6,7) and (8,9), by expanding the array from 1 to 3 points:
QPointArray a( 1 );
a[0] = QPoint( 4, 5 );
a.putPoints( 1, 2, 6,7, 8,9 ); // index == 1, points == 2
this has the same result, but here putPoints overwrites rather than extends:
QPointArray a( 3 );
a.putPoints( 0, 3, 4,5, 0,0, 8,9 );
a.putPoints( 1, 1, 6,7 );
the points are given as a sequence of integers, starting with firstx then firsty, and so on. just keep alternating bestie π
See also: resize().
bool QPointArray::putPoints ( int index, int nPoints, const QPointArray & from, int fromIndex = 0 )
this is an overloaded member function, provided for convenience. it behaves essentially like the above function.
this version of the function copies nPoints from from into this array, starting at index in this array and fromIndex in from. fromIndex is 0 by default. π
QPointArray a;
a.putPoints( 0, 3, 1,2, 0,0, 5,6 );
// a is now the three-point array ( 1,2, 0,0, 5,6 );
QPointArray b;
b.putPoints( 0, 3, 4,4, 5,5, 6,6 );
// b is now ( 4,4, 5,5, 6,6 );
a.putPoints( 2, 3, b );
// a is now ( 1,2, 0,0, 4,4, 5,5, 6,6 );
look at her combining, slay π
void QPointArray::setPoint ( uint index, int x, int y )
sets the point at position index in the array to (x, y). boom. done. β¨
Example: themes/wood.cpp.
void QPointArray::setPoint ( uint i, const QPoint & p )
this is an overloaded member function, provided for convenience. it behaves essentially like the above function.
sets the point at array index i to p. same energy, different outfit π
void QPointArray::translate ( int dx, int dy )
translates all the points in the array by (dx, dy). every single one. group move, no stragglers π«Ά
π RELATED FUNCTION DOCUMENTATION π
QDataStream & operator<< ( QDataStream & s, const QPointArray & a )
writes the point array a to the stream s and returns a reference to the stream. sending her off into the data stream, bon voyage π
See also: Format of the QDataStream operators.
QDataStream & operator>> ( QDataStream & s, QPointArray & a )
reads a point array a from the stream s and returns a reference to the stream. welcome home queen π β¨
See also: Format of the QDataStream operators.
π SEE ALSO π
π COPYRIGHT π
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.
βοΈ AUTHOR βοΈ
Generated automatically from the source code. (not me writing this by hand, the robots did it, and honestly? they ate π€π )
π BUGS π
if you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. good bug reports help us to help you. thank you. π (fr fr, be a good citizen, the devs are trying)
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. so like. she's a gift, not a guarantee, bestie π
if you find errors in this manual page, please report them to qt-bugs@trolltech.com. please include the name of the manual page (qpointarray.3qt) and the Qt version (3.3.8). iykyk, include the details or the report doesn't count π€
that's the whole page bestie, go forth and array your points πΈπ¦π
Trolltech AS Β· 2 February 2007 Β· Qt version 3.3.8 β mwah, she's archived but she's still iconic πβ¨
π¦ where this page comes from
- fedora 43: qt3-devel-docs 3.3.8b-102.fc43 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- fedora 44: qt3-devel-docs 3.3.8b-103.fc44 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms