This class extends TQTextEdit (in read-only mode), adding some navigation functionality so that users can follow links in hypertext documents. The contents of TQTextEdit is set with setText(), but TQTextBrowser has an additional function, setSource(), which makes it possible to set the text to a named document. The name is looked up in the text view's mime source factory. If a document name ends with an anchor (for example, "\fC#anchor"\fR), the text browser automatically scrolls to that position (using scrollToAnchor()). When the user clicks on a hyperlink, the browser will call setSource() itself, with the link's \fChref\fR value as argument. You can track the current source by connetion to the sourceChanged() signal.
TQTextBrowser provides backward() and forward() slots which you can use to implement Back and Forward buttons. The home() slot sets the text to the very first document displayed. The linkClicked() signal is emitted when the user clicks a link.
By using TQTextEdit::setMimeSourceFactory() you can provide your own subclass of QMimeSourceFactory. This makes it possible to access data from anywhere, for example from a network or from a database. See QMimeSourceFactory::data() for details.
If you intend using the mime factory to read the data directly from the file system, you may have to specify the encoding for the file extension you are using. For example:
TQTextBrowser interprets the tags it processes in accordance with the default style sheet. Change the style sheet with setStyleSheet(); see TQStyleSheet for details.
If you want to provide your users with editable rich text use TQTextEdit. If you want a text browser without hypertext navigation use TQTextEdit, and use TQTextEdit::setReadOnly() to disable editing. If you just need to display a small piece of rich text use QSimpleRichText or QLabel.
This signal is emitted when the user clicks an anchor. The \fIlink\fR is the value of the \fChref\fR i.e. the name of the target document. The \fIname\fR is the name of the anchor.
Changes the document displayed to the previous document in the list of documents built by navigating links. Does nothing if there is no previous document.
This signal is emitted when the availability of forward() changes. \fIavailable\fR is TRUE after the user navigates backward() and FALSE when the user navigates or goes forward().
This signal is emitted when the user has selected but not activated a link in the document. \fIlink\fR is the value of the \fChref\fR i.e. the name of the target document.
This signal is emitted when the mime source has changed, \fIsrc\fR being the new source.
.PP
Source changes happen both programmatically when calling setSource(), forward(), backword() or home() or when the user clicks on links or presses the equivalent key sequences.
.PP
Example: helpviewer/helpwindow.cpp.
.SS "Property Documentation"
.SH "bool modified"
This property holds whether the contents have been modified.
.SH "bool overwriteMode"
This property holds this text browser's overwrite mode.
.SH "bool readOnly"
This property holds whether the contents are read only.
Setting this property uses the mimeSourceFactory() to lookup the named document. It also checks for optional anchors and scrolls the document accordingly.
.PP
If the first tag in the document is \fC<qt type=detail>\fR, the document is displayed as a popup rather than as new document in the browser window itself. Otherwise, the document is displayed normally in the text browser with the text set to the contents of the named document with setText().
.PP
If you are using the filesystem access capabilities of the mime source factory, you must ensure that the factory knows about the encoding of specified files; otherwise no data will be available. The default factory handles a couple of common file extensions such as \fC*.html\fR and \fC*.txt\fR with reasonable defaults. See QMimeSourceFactory::data() for details.
.PP
Set this property's value with setSource() and get this property's value with source().
.SH "int undoDepth"
This property holds this text browser's undo depth.
.SH "bool undoRedoEnabled"
This property holds whether undo and redo are enabled.