Qt Jambi Home

com.trolltech.qt.gui
Class QLine

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.gui.QLine
All Implemented Interfaces:
QtJambiInterface

public class QLine
extends QtJambiObject

The QLine class provides a two-dimensional vector using integer precision.

A QLine describes a finite length line (or a line segment) on a two-dimensional surface. The start and end points of the line are specified using integer point accuracy for coordinates. Use the QLineF constructor to retrieve a floating point copy.

The positions of the line's start and end points can be retrieved using the p1, x1, y1, p2, x2, and y2 functions. The dx and dy functions return the horizontal and vertical components of the line. Use isNull to determine whether the QLine represents a valid line or a null line.

Finally, the line can be translated a given offset using the translate function.

See Also:
QLineF, QPolygon, QRect

Nested Class Summary
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
Constructor Summary
QLine()
          Constructs a null line.
QLine(int x1, int y1, int x2, int y2)
          Constructs a line object that represents the line between (x1, y1) and (x2, y2).
QLine(QPoint pt1, QPoint pt2)
          Constructs a line object that represents the line between pt1 and pt2.
 
Method Summary
 int dx()
          Returns the horizontal component of the line's vector.
 int dy()
          Returns the vertical component of the line's vector.
 boolean equals(java.lang.Object other)
          
static QLine fromNativePointer(QNativePointer nativePointer)
          This function returns the QLine instance pointed to by nativePointer
 boolean isNull()
          Returns true if the line is not set up with valid start and end point; otherwise returns false.
static QNativePointer nativePointerArray(QLine[] array)
          This function returns a QNativePointer that is pointing to the specified QLine array.
 QPoint p1()
          Returns the line's start point.
 QPoint p2()
          Returns the line's end point.
 void readFrom(QDataStream arg__1)
          Reads a QLine from arg__1.
 void translate(int dx, int dy)
          Translates this line the distance specified by dx and dy.
 void translate(QPoint p)
          Translates this line by the given p.
 void writeTo(QDataStream arg__1)
          Writes thisQLine to arg__1.
 int x1()
          Returns the x-coordinate of the line's start point.
 int x2()
          Returns the x-coordinate of the line's end point.
 int y1()
          Returns the y-coordinate of the line's start point.
 int y2()
          Returns the y-coordinate of the line's end point.
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QLine

public QLine(QPoint pt1,
             QPoint pt2)

Constructs a line object that represents the line between pt1 and pt2.


QLine

public QLine(int x1,
             int y1,
             int x2,
             int y2)

Constructs a line object that represents the line between (x1, y1) and (x2, y2).


QLine

public QLine()

Constructs a null line.

Method Detail

dx

public final int dx()

Returns the horizontal component of the line's vector.

See Also:
dy

dy

public final int dy()

Returns the vertical component of the line's vector.

See Also:
dx

isNull

public final boolean isNull()

Returns true if the line is not set up with valid start and end point; otherwise returns false.


writeTo

public final void writeTo(QDataStream arg__1)
Writes thisQLine to arg__1.


readFrom

public final void readFrom(QDataStream arg__1)
Reads a QLine from arg__1.


p1

public final QPoint p1()

Returns the line's start point.

See Also:
x1, y1, p2

p2

public final QPoint p2()

Returns the line's end point.

See Also:
x2, y2, p1

translate

public final void translate(int dx,
                            int dy)

Translates this line the distance specified by dx and dy.


translate

public final void translate(QPoint p)

Translates this line by the given p.


x1

public final int x1()

Returns the x-coordinate of the line's start point.

See Also:
p1

x2

public final int x2()

Returns the x-coordinate of the line's end point.

See Also:
p2

y1

public final int y1()

Returns the y-coordinate of the line's start point.

See Also:
p1

y2

public final int y2()

Returns the y-coordinate of the line's end point.

See Also:
p2

fromNativePointer

public static QLine fromNativePointer(QNativePointer nativePointer)
This function returns the QLine instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.

nativePointerArray

public static QNativePointer nativePointerArray(QLine[] array)
This function returns a QNativePointer that is pointing to the specified QLine array.

Parameters:
array - the array that the returned pointer will point to.
Returns:
a QNativePointer that is pointing to the specified array.

equals

public boolean equals(java.lang.Object other)

Overrides:
equals in class java.lang.Object

Qt Jambi Home