|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.gui.QTextDocumentWriter
public class QTextDocumentWriter
The QTextDocumentWriter class provides a format-independent interface for writing a QTextDocument
to files or other devices. To write a document, construct a QTextDocumentWriter object with either a file name or a device object, and specify the document format to be written. You can construct a writer and set the format using setFormat()
later.
Call write()
to write the document to the device. If the document is successfully written, this function returns true. However, if an error occurs when writing the document, it will return false.
Call supportedDocumentFormats()
for a list of formats that QTextDocumentWriter can write.
Since the capabilities of the supported output formats vary considerably, the writer simply outputs the appropriate subset of objects for each format. This typically includes the formatted text and images contained in a document.
Nested Class Summary |
---|
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 | |
---|---|
QTextDocumentWriter()
Constructs an empty QTextDocumentWriter object. |
|
QTextDocumentWriter(QIODevice device,
QByteArray format)
Constructs a QTextDocumentWriter object to write to the given device in the document format specified by format. |
|
QTextDocumentWriter(java.lang.String fileName)
Constructs an QTextDocumentWriter object that will write to a file with the name fileName, using the document format specified by format. |
|
QTextDocumentWriter(java.lang.String fileName,
QByteArray format)
Constructs an QTextDocumentWriter object that will write to a file with the name fileName, using the document format specified by format. |
Method Summary | |
---|---|
QTextCodec |
codec()
Returns the codec that is currently assigned to the writer. |
QIODevice |
device()
Returns the device currently assigned, or 0 if no device has been assigned. |
java.lang.String |
fileName()
If the currently assigned device is a QFile , or if setFileName() has been called, this function returns the name of the file to be written to. |
QByteArray |
format()
Returns the format used for writing documents. |
void |
setCodec(QTextCodec codec)
Sets the codec for this stream to codec. |
void |
setDevice(QIODevice device)
Sets the writer's device to the device specified. |
void |
setFileName(java.lang.String fileName)
Sets the name of the file to be written to fileName. |
void |
setFormat(QByteArray format)
Sets the format used to write documents to the format specified. |
static java.util.List |
supportedDocumentFormats()
Returns the list of document formats supported by QTextDocumentWriter. |
boolean |
write(QTextDocument document)
Writes the given document to the assigned device or file and returns true if successful; otherwise returns false. |
boolean |
write(QTextDocumentFragment fragment)
Writes the document fragment specified by fragment to the assigned device or file and returns true if successful; otherwise returns false. |
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 |
---|
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 QTextDocumentWriter()
setFormat()
to set a document format, then setDevice()
or setFileName()
.
public QTextDocumentWriter(QIODevice device, QByteArray format)
public QTextDocumentWriter(java.lang.String fileName)
public QTextDocumentWriter(java.lang.String fileName, QByteArray format)
Method Detail |
---|
public final QTextCodec codec()
setCodec()
.
public final QIODevice device()
setDevice()
.
public final java.lang.String fileName()
QFile
, or if setFileName()
has been called, this function returns the name of the file to be written to. In all other cases, it returns an empty string. setFileName()
, and setDevice()
.
public final QByteArray format()
setFormat()
.
public final void setCodec(QTextCodec codec)
codec()
.
public final void setDevice(QIODevice device)
If the device is not already open, QTextDocumentWriter will attempt to open the device in QIODevice::WriteOnly
mode by calling open().
Note: This will not work for certain devices, such as QProcess
, QTcpSocket
and QUdpSocket
, where some configuration is required before the device can be opened.
device()
, and setFileName()
.
public final void setFileName(java.lang.String fileName)
QFile
and open it in QIODevice::WriteOnly
mode, and use this file when writing the document. fileName()
, and setDevice()
.
public final void setFormat(QByteArray format)
QTextDocumentWriter writer; writer.setFormat("odf"); // same as writer.setFormat("ODF");You can call
supportedDocumentFormats()
for the full list of formats QTextDocumentWriter supports. format()
.
public final boolean write(QTextDocument document)
public final boolean write(QTextDocumentFragment fragment)
public static java.util.List supportedDocumentFormats()
By default, Qt can write the following formats:
plaintext | Plain text |
HTML | HyperText Markup Language |
ODF | OpenDocument Format |
setFormat()
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |