|
|
||||||||||
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.QTextFragment
public class QTextFragment
The QTextFragment class holds a piece of text in a QTextDocument with a single QTextCharFormat.
A text fragment describes a piece of text that is stored with a single character format. Text in which the character format changes can be represented by sequences of text fragments with different formats.
If the user edits the text in a fragment and introduces a different character format, the fragment's text will be split at each point where the format changes, and new fragments will be created. For example, changing the style of some text in the middle of a sentence will cause the fragment to be broken into three separate fragments: the first and third with the same format as before, and the second with the new style. The first fragment will contain the text from the beginning of the sentence, the second will contain the text from the middle, and the third takes the text from the end of the sentence.
A fragment's text and character format can be obtained with the text and charFormat functions. The length function gives the length of the text in the fragment. position gives the position in the document of the start of the fragment. To determine whether the fragment contains a particular position within the document, use the contains function.
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 | |
---|---|
QTextFragment()
Creates a new empty text fragment. |
|
QTextFragment(QTextFragment o)
Copies the content (text and format) of the o text fragment to this text fragment. |
Method Summary | |
---|---|
QTextCharFormat |
charFormat()
Returns the text fragment's character format. |
int |
charFormatIndex()
Returns an index into the document's internal list of character formats for the text fragment's character format. |
int |
compareTo(java.lang.Object other)
|
boolean |
contains(int position)
Returns true if the text fragment contains the text at the given position in the document; otherwise returns false. |
boolean |
equals(java.lang.Object other)
|
static QTextFragment |
fromNativePointer(QNativePointer nativePointer)
This function returns the QTextFragment instance pointed to by nativePointer |
boolean |
isValid()
Returns true if this is a valid text fragment (i.e. has a valid position in a document); otherwise returns false. |
int |
length()
Returns the number of characters in the text fragment. |
static QNativePointer |
nativePointerArray(QTextFragment[] array)
This function returns a QNativePointer that is pointing to the specified QTextFragment array. |
int |
position()
Returns the position of this text fragment in the document. |
java.lang.String |
text()
Returns the text fragment's as plain text. |
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 |
---|
public QTextFragment(QTextFragment o)
Copies the content (text and format) of the o text fragment to this text fragment.
public QTextFragment()
Creates a new empty text fragment.
Method Detail |
---|
public final QTextCharFormat charFormat()
Returns the text fragment's character format.
public final int charFormatIndex()
Returns an index into the document's internal list of character formats for the text fragment's character format.
public final boolean contains(int position)
Returns true if the text fragment contains the text at the given position in the document; otherwise returns false.
public final boolean isValid()
Returns true if this is a valid text fragment (i.e. has a valid position in a document); otherwise returns false.
public final int length()
Returns the number of characters in the text fragment.
public final int position()
Returns the position of this text fragment in the document.
public final java.lang.String text()
Returns the text fragment's as plain text.
public static QTextFragment fromNativePointer(QNativePointer nativePointer)
nativePointer
- the QNativePointer of which object should be returned.public static QNativePointer nativePointerArray(QTextFragment[] array)
array
- the array that the returned pointer will point to.
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int compareTo(java.lang.Object other)
compareTo
in interface java.lang.Comparable
|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |