Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.gui
Class QLine

    java.lang.Object
      com.trolltech.qt.QSignalEmitter
          com.trolltech.qt.QtJambiObject
              com.trolltech.qt.gui.QLine

All Implemented Interfaces:
  QtJambiInterface, java.lang.Cloneable

    public class QLine

extends QtJambiObject
implements java.lang.Cloneable

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`, and `QRect`.

Nested Class Summary

Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
`QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9`

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 `p1` and `p2`.

Method Summary
`QLine` | `clone()` This method is reimplemented for internal reasons
`int` | `dx()` Returns the horizontal component of the line's vector.
`int` | `dy()` Returns the vertical component of the line's vector.
`static QLine` | `fromNativePointer(QNativePointer nativePointer)` This method 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
`void` | `setLine(int x1, int y1, int x2, int y2)` Sets this line to the start in `x1`, `y1` and end in `x2`, `y2`.
`void` | `setP1(QPoint p1)` Sets the starting point of this line to `p1`.
`void` | `setP2(QPoint p2)` Sets the end point of this line to `p2`.
`void` | `setPoints(QPoint p1, QPoint p2)` Sets the start point of this line to `p1` and the end point of this line to `p2`.
`java.lang.String` | `toString()` Returns a string representation of the `this QLine`.
`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 `offset`.
`QLine` | `translated(int dx, int dy)` Returns this line translated the distance specified by `dx` and `dy`.
`QLine` | `translated(QPoint p)` Returns this line translated by the given `offset`.
`void` | `writeTo(QDataStream arg__1)` Writes thisQLine
`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, equals, 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
`getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface com.trolltech.qt.QtJambiInterface
`disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership`

Constructor Detail

### QLine

    public QLine()

  Constructs a null line.

### QLine

    public QLine(QPoint pt1,
                 QPoint pt2)

  Constructs a line object that represents the line between `p1` and `p2`.

### 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`).

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

### readFrom

    public final void readFrom(QDataStream arg__1)

  Reads a QLine

### p1

    public final QPoint p1()

  Returns the line's start point.

See also:
  `setP1()`, `x1()`, `y1()`, and `p2()`.

### p2

    public final QPoint p2()

  Returns the line's end point.

See also:
  `setP2()`, `x2()`, `y2()`, and `p1()`.

### setLine

    public final void setLine(int x1,
                              int y1,
                              int x2,
                              int y2)

  Sets this line to the start in `x1`, `y1` and end in `x2`, `y2`.

See also:
  `setP1()`, `setP2()`, `p1()`, and `p2()`.

### setP1

    public final void setP1(QPoint p1)

  Sets the starting point of this line to `p1`.

See also:
  `setP2()`, and `p1()`.

### setP2

    public final void setP2(QPoint p2)

  Sets the end point of this line to `p2`.

See also:
  `setP1()`, and `p2()`.

### setPoints

    public final void setPoints(QPoint p1,
                                QPoint p2)

  Sets the start point of this line to `p1` and the end point of this line to `p2`.

See also:
  `setP1()`, `setP2()`, `p1()`, and `p2()`.

### translate

    public final void translate(QPoint p)

  Translates this line by the given `offset`.

### translate

    public final void translate(int dx,
                                int dy)

  Translates this line the distance specified by `dx` and `dy`.

### translated

    public final QLine translated(QPoint p)

  Returns this line translated by the given `offset`.

### translated

    public final QLine translated(int dx,
                                  int dy)

  Returns this line translated the distance specified by `dx` and `dy`.

### 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 method returns the QLine instance pointed to by `nativePointer`.

### nativePointerArray

    public static QNativePointer nativePointerArray(QLine[] array)

  This function returns a QNativePointer that is pointing to the specified QLine array.

### toString

    public java.lang.String toString()

  Returns a string representation of the `this QLine`.

  Overrides:
    `toString` in class `java.lang.Object`

### clone

    public QLine clone()

  This method is reimplemented for internal reasons

  Overrides:
    `clone` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD