|  | Home · All Classes · Modules

# QPointF Class Reference
[QtCore module]

The QPointF class defines a point in the plane using floating point precision. More...

### Methods

- __init__ (self)
- __init__ (self, QPainterPath.Element)
- __init__ (self, float xpos, float ypos)
- __init__ (self, QPoint p)
- __init__ (self, QPointF other)
- bool isNull (self)
- setX (self, float xpos)
- setY (self, float ypos)
- QPoint toPoint (self)
- float x (self)
- float y (self)

### Special Methods

- QPointF __mul__ (self, QMatrix m)
- QPointF __mul__ (self, QTransform m)
- QPointF __add__ (self, QPointF p2)
- QPointF __div__ (self, float c)
- bool __eq__ (self, QPointF p2)
- QPointF __iadd__ (self, QPointF p)
- QPointF __idiv__ (self, float c)
- QPointF __imul__ (self, float c)
- QPointF __isub__ (self, QPointF p)
- QPointF __mul__ (self, float c)
- bool __ne__ (self, QPointF p2)
- QPointF __neg__ (self, QPointF p)
- int __nonzero__ (self)
- object __repr__ (self)
- QPointF __sub__ (self, QPointF p2)

## Detailed Description

This class can be pickled.

The QPointF class defines a point in the plane using floating point precision.

A point is specified by a x coordinate and an y coordinate which can be accessed using the x() and y() functions. The coordinates of the point are specified using floating point numbers for accuracy. The isNull() function returns true if both x and y are set to 0.0. The coordinates can be set (or altered) using the setX() and setY() functions, or alternatively the rx() and ry() functions which return references to the coordinates (allowing direct manipulation).

Given a point p, the following statements are all equivalent:

             QPointF p;

             p.setX(p.x() + 1.0);
             p += QPointF(1.0, 0.0);
             p.rx()++;

A QPointF object can also be used as a vector: Addition and subtraction are defined as for vectors (each component is added separately). A QPointF object can also be divided or multiplied by an `int` or a `qreal`.

In addition, the QPointF class provides a constructor converting a QPoint object into a QPointF object, and a corresponding toPoint() function which returns a QPoint copy of this point. Finally, QPointF objects can be streamed as well as compared.

See also QPoint and QPolygonF.

## Method Documentation

### QPointF.__init__ (self)

Constructs a null point, i.e. with coordinates (0.0, 0.0)

See also isNull().

### QPointF.__init__ (self, QPainterPath.Element)

This method is only available if the QtGui module is imported.

Constructs a null point, i.e. with coordinates (0.0, 0.0)

See also isNull().

### QPointF.__init__ (self, float xpos, float ypos)

Constructs a copy of the given point.

See also toPoint().

### QPointF.__init__ (self, QPoint p)

Constructs a point with the given coordinates (x, y).

See also setX() and setY().

### QPointF.__init__ (self, QPointF other)

### bool QPointF.isNull (self)

Returns true if both the x and y coordinates are set to 0.0, otherwise returns false.

### QPointF.setX (self, float xpos)

Sets the x coordinate of this point to the given x coordinate.

See also x() and setY().

### QPointF.setY (self, float ypos)

Sets the y coordinate of this point to the given y coordinate.

See also y() and setX().

### QPoint QPointF.toPoint (self)

Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rounded coordinates.

See also QPointF().

### float QPointF.x (self)

Returns the x-coordinate of this point.

See also setX() and rx().

### float QPointF.y (self)

Returns the y-coordinate of this point.

See also setY() and ry().

### QPointF __mul__ (self, QMatrix m)

This method is only available if the QtGui module is imported.

### QPointF __mul__ (self, QTransform m)

This method is only available if the QtGui module is imported.

### QPointF QPointF.__add__ (self, QPointF p2)

### QPointF QPointF.__div__ (self, float c)

### bool QPointF.__eq__ (self, QPointF p2)

### QPointF QPointF.__iadd__ (self, QPointF p)

### QPointF QPointF.__idiv__ (self, float c)

### QPointF QPointF.__imul__ (self, float c)

### QPointF QPointF.__isub__ (self, QPointF p)

### QPointF QPointF.__mul__ (self, float c)

### bool QPointF.__ne__ (self, QPointF p2)

### QPointF QPointF.__neg__ (self, QPointF p)

### int QPointF.__nonzero__ (self)

### object QPointF.__repr__ (self)

### QPointF QPointF.__sub__ (self, QPointF p2)