com.trolltech.qt.core
Class QPointF

java.lang.Object
  extended by com.trolltech.qt.internal.QSignalEmitterInternal
      extended by com.trolltech.qt.QSignalEmitter
          extended by com.trolltech.qt.QtJambiObject
              extended by com.trolltech.qt.core.QPointF
All Implemented Interfaces:
QtJambiInterface, java.lang.Cloneable

public class QPointF
extends QtJambiObject
implements java.lang.Cloneable

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 = new QPointF();

        p.setX(p.x() + 1.0);
        p.add(new QPointF(1.0, 0.0));
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.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.PrivateSignal0, QSignalEmitter.PrivateSignal1, QSignalEmitter.PrivateSignal2, QSignalEmitter.PrivateSignal3, QSignalEmitter.PrivateSignal4, QSignalEmitter.PrivateSignal5, QSignalEmitter.PrivateSignal6, QSignalEmitter.PrivateSignal7, QSignalEmitter.PrivateSignal8, QSignalEmitter.PrivateSignal9, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9
 
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal
 
Field Summary
 
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
currentSender
 
Constructor Summary
QPointF()
          Constructs a null point, i.
QPointF(double xpos, double ypos)
          Constructs a point with the given coordinates (x, y).
QPointF(QPoint p)
          Constructs a copy of the given point.
 
Method Summary
 QPointF add(QPointF p)
          Adds p to this QPointF and returns the result.
 QPointF clone()
          This method is reimplemented for internal reasons
 QPointF divide(double d)
          Divides this QPointF by deviser s and returns the result.
 boolean isNull()
          Returns true if both the x and y coordinates are set to 0.0, otherwise returns false.
 QPointF multiply(double d)
          Multiplies this QPointF by factor d and returns the result.
 void readFrom(QDataStream arg__1)
          Reads a QPointF
 void setX(double x)
          Sets the x coordinate of this point to the given x coordinate.
 void setY(double y)
          Sets the y coordinate of this point to the given y coordinate.
 QPointF subtract(QPointF p)
          Subtracts p from this QPointF and returns the result.
 QPoint toPoint()
          Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rounded coordinates.
 java.lang.String toString()
          Returns a string representation of the this QPointF.
 void writeTo(QDataStream arg__1)
          Writes thisQPointF
 double x()
          Returns the x-coordinate of this point.
 double y()
          Returns the y-coordinate of this point.
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
__qt_signalInitialization
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QPointF

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

See also:
isNull().


QPointF

public QPointF(QPoint p)
Constructs a copy of the given point.

See also:
toPoint().


QPointF

public QPointF(double xpos,
               double ypos)
Constructs a point with the given coordinates (x, y).

See also:
setX(), and setY().

Method Detail

isNull

public final boolean isNull()
Returns true if both the x and y coordinates are set to 0.0, otherwise returns false.


writeTo

public final void writeTo(QDataStream arg__1)
Writes thisQPointF


readFrom

public final void readFrom(QDataStream arg__1)
Reads a QPointF


setX

public final void setX(double x)
Sets the x coordinate of this point to the given x coordinate.

See also:
x(), and setY().


setY

public final void setY(double y)
Sets the y coordinate of this point to the given y coordinate.

See also:
y(), and setX().


toPoint

public final QPoint toPoint()
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rounded coordinates.

See also:
QPointF().


x

public final double x()
Returns the x-coordinate of this point.

See also:
setX(), and rx().


y

public final double y()
Returns the y-coordinate of this point.

See also:
setY(), and ry().


multiply

public final QPointF multiply(double d)
Multiplies this QPointF by factor d and returns the result.


divide

public final QPointF divide(double d)
Divides this QPointF by deviser s and returns the result.


add

public final QPointF add(QPointF p)
Adds p to this QPointF and returns the result.


subtract

public final QPointF subtract(QPointF p)
Subtracts p from this QPointF and returns the result.


toString

public java.lang.String toString()
Returns a string representation of the this QPointF.

Overrides:
toString in class java.lang.Object

clone

public QPointF clone()
This method is reimplemented for internal reasons

Overrides:
clone in class java.lang.Object