Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# QPointF Class Reference

The QPointF class provides a point object that uses floating point coordinates for accuracy. More...

    #include <QPointF>

- List of all members, including inherited members

### Public Functions

- QPointF ()
- QPointF ( const QPoint & point )
- QPointF ( float x, float y )
- bool isNull () const
- float & rx ()
- float & ry ()
- void setX ( float x )
- void setY ( float y )
- QPoint toPoint () const
- float x () const
- float y () const
- QPointF & operator*= ( float factor )
- QPointF & operator+= ( const QPointF & other )
- QPointF & operator-= ( const QPointF & other )
- QPointF & operator/= ( float factor )

### Related Non-Members

- QDataStream & operator<< ( QDataStream & s, const QPointF & p )
- QDataStream & operator>> ( QDataStream & s, QPointF & p )

## Detailed Description

The QPointF class provides a point object that uses floating point coordinates for accuracy.

A QPointF describes a point on a two-dimensional surface. The coordinates of the point are specified using floating point numbers for accuracy. If you only need the accuracy of integers, you may want to use QPoint instead of this class.

Convenience functions are provided for reading and writing the individual coordinates used to define the point: x(), y(), setX(), and setY().

See also QPointF.

## Member Function Documentation

### QPointF::QPointF ()

Constructs a null point.

### QPointF::QPointF ( const QPoint & point )

Copy constructor. Constructs a point using the values of the point specified.

### QPointF::QPointF ( float x, float y )

Constructs a point with coordinates specified by x and y.

### bool QPointF::isNull () const

Returns true if the point is not set up; otherwise returns false.

### float & QPointF::rx ()

Returns a reference to the x-coordinate of the point.

### float & QPointF::ry ()

Returns a reference to the y-coordinate of the point.

### void QPointF::setX ( float x )

Sets the x-coordinate of the point to the value specified by x.

### void QPointF::setY ( float y )

Sets the y-coordinate of the point to the value specified by y.

### QPoint QPointF::toPoint () const

Converts the coordinates of this point to integers and returns a QPoint with these coordinates.

See also QPoint.

### float QPointF::x () const

Returns the x-coordinate of the point.

### float QPointF::y () const

Returns the y-coordinate of the point.

### QPointF & QPointF::operator*= ( float factor )

Multiplies the coordinates of this point by the given scale factor, and returns a reference to this point with the new coordinates. (Scalar multiplication of a vector.)

See also operator*() and operator/=().

### QPointF & QPointF::operator+= ( const QPointF & other )

Adds the coordinates of this point to the corresponding coordinates of the other point, and returns a reference to this point with the new coordinates. (Vector addition.)

See also operator+() and operator-=().

### QPointF & QPointF::operator-= ( const QPointF & other )

Subtracts the coordinates of the other point from the corresponding coordinates of this point, and returns a reference to this point with the new coordinates. (Vector subtraction.)

See also operator-() and operator+=().

### QPointF & QPointF::operator/= ( float factor )

Divides the coordinates of this point by the given scale factor, and returns a references to this point with the new coordinates. (Scalar division of a vector.)

See also operator*().

## Related Non-Members

### QDataStream & operator<< ( QDataStream & s, const QPointF & p )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Writes point p to the stream s and returns a reference to the stream.

See also Format of the QDataStream operators.

### QDataStream & operator>> ( QDataStream & s, QPointF & p )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Reads a QPoint from the stream s into point p and returns a reference to the stream.

See also Format of the QDataStream operators.