Qt Jambi Home

com.trolltech.qt.gui
Class QTextLine

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

public class QTextLine
extends QtJambiObject

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
          Press link for info on QTextLine.CursorPosition
static class QTextLine.Edge
          Press link for info on QTextLine.Edge
 
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
QTextLine()
          Creates an invalid line.
 
Method Summary
 double ascent()
          Returns the line's ascent.
 double cursorToX(int cursorPos)
          Equivalent to cursorToX(cursorPos, Leading).
 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.
static QTextLine fromNativePointer(QNativePointer nativePointer)
          This function returns the QTextLine instance pointed to by nativePointer
 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.
static QNativePointer nativePointerArray(QTextLine[] array)
          This function returns a QNativePointer that is pointing to the specified QTextLine array.
 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)
          Equivalent to xToCursor(x, CursorBetweenCharacters).
 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, arg__2.
 double y()
          Returns the line's y position.
 
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, equals, 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, height

cursorToX

public final double cursorToX(int cursorPos)

Equivalent to cursorToX(cursorPos, Leading).


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.


descent

public final double descent()

Returns the line's descent.

See Also:
ascent, height

height

public final double height()

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

See Also:
ascent, 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, 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 columns. In case the text cannot be split until columns 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 columns. In case the text cannot be split until columns 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, rect

x

public final double x()

Returns the line's x position.

See Also:
rect, y, textLength, width

xToCursor

public final int xToCursor(double x)

Equivalent to xToCursor(x, CursorBetweenCharacters).


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, arg__2.

See Also:
cursorToX

y

public final double y()

Returns the line's y position.

See Also:
x, rect, textLength, width

fromNativePointer

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

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

nativePointerArray

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

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

draw

public final void draw(QPainter painter,
                       QPointF position)
This is an overloaded method provided for convenience.


Qt Jambi Home