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 QTextLine

    java.lang.Object
      com.trolltech.qt.internal.QSignalEmitterInternal
          com.trolltech.qt.QSignalEmitter
              com.trolltech.qt.QtJambiObject
                  com.trolltech.qt.gui.QTextLine

All Implemented Interfaces:
  QtJambiInterface, java.lang.Cloneable

    public class QTextLine

extends QtJambiObject
implements java.lang.Cloneable

The `QTextLine` class represents a line of text inside a `QTextLayout`. A text line is usually created by `QTextLayout::createLine()`.

After being created, the line can be filled using the `setLineWidth()` or `setNumColumns()` functions. A line has a number of attributes including the rectangle it occupies, `rect()`, its coordinates, `x()` and `y()`, its `textLength()`, `width()` and `naturalTextWidth()`, and its `ascent()` and decent() relative to the text. The position of the cursor in terms of the line is available from `cursorToX()` and its inverse from `xToCursor()`. A line can be moved with `setPosition()`.

Nested Class Summary
`static class` | `QTextLine.CursorPosition`
`static class` | `QTextLine.Edge`

Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
`QSignalEmitter.AbstractSignal, 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
`QTextLine()` Creates an invalid line.

Method Summary
`double` | `ascent()` Returns the line's ascent.
`QTextLine` | `clone()` This method is reimplemented for internal reasons
`double` | `cursorToX(int cursorPos)` Converts the cursor position `cursorPos` to the corresponding x position inside the line, taking account of the `edge`.
`double` | `cursorToX(int cursorPos, QTextLine.Edge edge)` Converts the cursor position `cursorPos` to the corresponding x position inside the line, taking account of the `edge`.
`double` | `descent()` Returns the line's descent.
`void` | `draw(QPainter painter, QPointF position)` This is an overloaded method provided for convenience.
`double` | `height()` Returns the line's height.
`boolean` | `isValid()` Returns true if this text line is valid; otherwise returns false.
`int` | `lineNumber()` Returns the position of the line in the text engine.
`QRectF` | `naturalTextRect()` Returns the rectangle covered by the line.
`double` | `naturalTextWidth()` Returns the width of the line that is occupied by text.
`QPointF` | `position()` Returns the line's position relative to the text layout's position.
`QRectF` | `rect()` Returns the line's bounding rectangle.
`void` | `setLineWidth(double width)` Lays out the line with the given `width`.
`void` | `setNumColumns(int columns)` Lays out the line.
`void` | `setNumColumns(int columns, double alignmentWidth)` Lays out the line.
`void` | `setPosition(QPointF pos)` Moves the line to position `pos`.
`int` | `textLength()` Returns the length of the text in the line.
`int` | `textStart()` Returns the start of the line from the beginning of the string passed to the `QTextLayout`.
`double` | `width()` Returns the line's width as specified by the layout() function.
`double` | `x()` Returns the line's x position.
`int` | `xToCursor(double x)` Converts the x-coordinate `x`, to the nearest matching cursor position, depending on the cursor position type, `cpos`.
`int` | `xToCursor(double x, QTextLine.CursorPosition arg__2)` Converts the x-coordinate `x`, to the nearest matching cursor position, depending on the cursor position type, `cpos`.
`double` | `y()` Returns the line's y position.

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, toString, wait, wait, wait`

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

Constructor Detail

### QTextLine

    public QTextLine()

  Creates an invalid line.

Method Detail

### ascent

    public final double ascent()

  Returns the line's ascent.

See also:
  `descent()`, and `height()`.

### cursorToX

    public final double cursorToX(int cursorPos)

  Converts the cursor position `cursorPos` to the corresponding x position inside the line, taking account of the `edge`.

  If `cursorPos` is not a valid cursor position, the nearest valid cursor position will be used instead, and cpos will be modified to point to this valid cursor position.

See also:
  `xToCursor()`.

### cursorToX

    public final double cursorToX(int cursorPos,
                                  QTextLine.Edge edge)

  Converts the cursor position `cursorPos` to the corresponding x position inside the line, taking account of the `edge`.

  If `cursorPos` is not a valid cursor position, the nearest valid cursor position will be used instead, and cpos will be modified to point to this valid cursor position.

See also:
  `xToCursor()`.

### descent

    public final double descent()

  Returns the line's descent.

See also:
  `ascent()`, and `height()`.

### height

    public final double height()

  Returns the line's height. This is equal to `ascent()` + `descent()` + 1.

See also:
  `ascent()`, and `descent()`.

### isValid

    public final boolean isValid()

  Returns true if this text line is valid; otherwise returns false.

### lineNumber

    public final int lineNumber()

  Returns the position of the line in the text engine.

### naturalTextRect

    public final QRectF naturalTextRect()

  Returns the rectangle covered by the line.

### naturalTextWidth

    public final double naturalTextWidth()

  Returns the width of the line that is occupied by text. This is always <= to `width()`, and is the minimum width that could be used by layout() without changing the line break position.

### position

    public final QPointF position()

  Returns the line's position relative to the text layout's position.

See also:
  `setPosition()`.

### rect

    public final QRectF rect()

  Returns the line's bounding rectangle.

See also:
  `x()`, `y()`, `textLength()`, and `width()`.

### setLineWidth

    public final void setLineWidth(double width)

  Lays out the line with the given `width`. The line is filled from its starting position with as many characters as will fit into the line. In case the text cannot be split at the end of the line, it will be filled with additional characters to the next whitespace or end of the text.

### setNumColumns

    public final void setNumColumns(int columns)

  Lays out the line. The line is filled from its starting position with as many characters as are specified by `numColumns`. In case the text cannot be split until `numColumns` characters, the line will be filled with as many characters to the next whitespace or end of the text.

### setNumColumns

    public final void setNumColumns(int columns,
                                    double alignmentWidth)

  Lays out the line. The line is filled from its starting position with as many characters as are specified by `numColumns`. In case the text cannot be split until `numColumns` characters, the line will be filled with as many characters to the next whitespace or end of the text. The provided `alignmentWidth` is used as reference width for alignment.

### setPosition

    public final void setPosition(QPointF pos)

  Moves the line to position `pos`.

See also:
  `position()`.

### textLength

    public final int textLength()

  Returns the length of the text in the line.

See also:
  `naturalTextWidth()`.

### textStart

    public final int textStart()

  Returns the start of the line from the beginning of the string passed to the `QTextLayout`.

### width

    public final double width()

  Returns the line's width as specified by the layout() function.

See also:
  `naturalTextWidth()`, `x()`, `y()`, `textLength()`, and `rect()`.

### x

    public final double x()

  Returns the line's x position.

See also:
  `rect()`, `y()`, `textLength()`, and `width()`.

### xToCursor

    public final int xToCursor(double x)

  Converts the x-coordinate `x`, to the nearest matching cursor position, depending on the cursor position type, `cpos`.

See also:
  `cursorToX()`.

### xToCursor

    public final int xToCursor(double x,
                               QTextLine.CursorPosition arg__2)

  Converts the x-coordinate `x`, to the nearest matching cursor position, depending on the cursor position type, `cpos`.

See also:
  `cursorToX()`.

### y

    public final double y()

  Returns the line's y position.

See also:
  `x()`, `rect()`, `textLength()`, and `width()`.

### draw

    public final void draw(QPainter painter,
                           QPointF position)

  This is an overloaded method provided for convenience.

### clone

    public QTextLine 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