|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.gui.QTextLine
public class QTextLine
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.AbstractSignal, 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 |
---|
public QTextLine()
Creates an invalid line.
Method Detail |
---|
public final double ascent()
Returns the line's ascent.
public final double cursorToX(int cursorPos)
Equivalent to cursorToX(cursorPos, Leading).
public final double cursorToX(int cursorPos, QTextLine.Edge edge)
public final double descent()
Returns the line's descent.
public final double height()
public final boolean isValid()
Returns true if this text line is valid; otherwise returns false.
public final int lineNumber()
Returns the position of the line in the text engine.
public final QRectF naturalTextRect()
Returns the rectangle covered by the line.
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.
public final QPointF position()
Returns the line's position relative to the text layout's position.
public final QRectF rect()
Returns the line's bounding rectangle.
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.
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.
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.
public final void setPosition(QPointF pos)
Moves the line to position pos.
public final int textLength()
Returns the length of the text in the line.
public final int textStart()
Returns the start of the line from the beginning of the string passed to the QTextLayout.
public final double width()
Returns the line's width as specified by the layout() function.
public final double x()
Returns the line's x position.
public final int xToCursor(double x)
Equivalent to xToCursor(x, CursorBetweenCharacters).
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.
public final double y()
Returns the line's y position.
public static QTextLine fromNativePointer(QNativePointer nativePointer)
nativePointer
- the QNativePointer of which object should be returned.public static QNativePointer nativePointerArray(QTextLine[] array)
array
- the array that the returned pointer will point to.
public final void draw(QPainter painter, QPointF position)
|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |