|
|||||||||
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.QTextDocumentFragment
public class QTextDocumentFragment
The QTextDocumentFragment
class represents a piece of formatted text from a QTextDocument
. A QTextDocumentFragment
is a fragment of rich text, that can be inserted into a QTextDocument
. A document fragment can be created from a QTextDocument
, from a QTextCursor
's selection, or from another document fragment. Document fragments can also be created by the static functions, fromPlainText()
and fromHtml()
.
The contents of a document fragment can be obtained as plain text by using the toPlainText()
function, or it can be obtained as HTML with toHtml()
.
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 | |
---|---|
QTextDocumentFragment()
Constructs an empty QTextDocumentFragment . |
|
QTextDocumentFragment(QTextCursor range)
Creates a QTextDocumentFragment from the cursor's selection. |
|
QTextDocumentFragment(QTextDocument document)
Converts the given document into a QTextDocumentFragment . |
|
QTextDocumentFragment(QTextDocumentFragment rhs)
Copy constructor. |
Method Summary | |
---|---|
QTextDocumentFragment |
clone()
This method is reimplemented for internal reasons |
static QTextDocumentFragment |
fromHtml(java.lang.String html)
Returns a QTextDocumentFragment based on the arbitrary piece of HTML in the given text. |
static QTextDocumentFragment |
fromHtml(java.lang.String html,
QTextDocument resourceProvider)
Returns a QTextDocumentFragment based on the arbitrary piece of HTML in the given text. |
static QTextDocumentFragment |
fromNativePointer(QNativePointer nativePointer)
|
static QTextDocumentFragment |
fromPlainText(java.lang.String plainText)
Returns a document fragment that contains the given plainText. |
boolean |
isEmpty()
Returns true if the fragment is empty; otherwise returns false. |
static QNativePointer |
nativePointerArray(QTextDocumentFragment[] array)
|
java.lang.String |
toHtml()
Returns the contents of the document fragment as HTML, using the specified encoding (e.g., "UTF-8", "ISO 8859-1"). |
java.lang.String |
toHtml(QByteArray encoding)
Returns the contents of the document fragment as HTML, using the specified encoding (e.g., "UTF-8", "ISO 8859-1"). |
java.lang.String |
toPlainText()
Returns the document fragment's text as plain text (i.e. |
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, toString, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Constructor Detail |
---|
public QTextDocumentFragment()
QTextDocumentFragment
. isEmpty()
.
public QTextDocumentFragment(QTextCursor range)
QTextDocumentFragment
from the cursor's selection. If the cursor doesn't have a selection, the created fragment is empty. isEmpty()
, and QTextCursor::selection()
.
public QTextDocumentFragment(QTextDocument document)
QTextDocumentFragment
. Note that the QTextDocumentFragment
only stores the document contents, not meta information like the document's title.
public QTextDocumentFragment(QTextDocumentFragment rhs)
Method Detail |
---|
public final boolean isEmpty()
public final java.lang.String toHtml()
public final java.lang.String toHtml(QByteArray encoding)
toPlainText()
, QTextDocument::toHtml()
, and QTextCodec
.
public final java.lang.String toPlainText()
toHtml()
.
public static QTextDocumentFragment fromHtml(java.lang.String html)
QTextDocumentFragment
based on the arbitrary piece of HTML in the given text. The formatting is preserved as much as possible; for example, "<b>bold</b>" will become a document fragment with the text "bold" with a bold character format.
public static QTextDocumentFragment fromHtml(java.lang.String html, QTextDocument resourceProvider)
QTextDocumentFragment
based on the arbitrary piece of HTML in the given text. The formatting is preserved as much as possible; for example, "<b>bold</b>" will become a document fragment with the text "bold" with a bold character format. If the provided HTML contains references to external resources such as imported style sheets, then they will be loaded through the resourceProvider.
public static QTextDocumentFragment fromPlainText(java.lang.String plainText)
When inserting such a fragment into a QTextDocument
the current char format of the QTextCursor
used for insertion is used as format for the text.
public static QTextDocumentFragment fromNativePointer(QNativePointer nativePointer)
public static QNativePointer nativePointerArray(QTextDocumentFragment[] array)
public QTextDocumentFragment clone()
clone
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |