1QTextBrowser(3qt)                                            QTextBrowser(3qt)
2
3
4

NAME

6       QTextBrowser - Rich text browser with hypertext navigation
7

SYNOPSIS

9       #include <qtextbrowser.h>
10
11       Inherits QTextEdit.
12
13   Public Members
14       QTextBrowser ( QWidget * parent = 0, const char * name = 0 )
15       QString source () const
16
17   Public Slots
18       virtual void setSource ( const QString & name )
19       virtual void backward ()
20       virtual void forward ()
21       virtual void home ()
22       virtual void reload ()
23
24   Signals
25       void backwardAvailable ( bool available )
26       void forwardAvailable ( bool available )
27       void sourceChanged ( const QString & src )
28       void highlighted ( const QString & link )
29       void linkClicked ( const QString & link )
30       void anchorClicked ( const QString & name, const QString & link )
31
32   Properties
33       bool modified - whether the contents have been modified  (read only)
34       bool overwriteMode - this text browser's overwrite mode  (read only)
35       bool readOnly - whether the contents are read only  (read only)
36       QString source - the name of the displayed document
37       int undoDepth - this text browser's undo depth  (read only)
38       bool undoRedoEnabled - whether undo and redo are enabled  (read only)
39
40   Protected Members
41       virtual void keyPressEvent ( QKeyEvent * e )
42

DESCRIPTION

44       The QTextBrowser class provides a rich text browser with hypertext
45       navigation.
46
47       This class extends QTextEdit (in read-only mode), adding some
48       navigation functionality so that users can follow links in hypertext
49       documents. The contents of QTextEdit is set with setText(), but
50       QTextBrowser has an additional function, setSource(), which makes it
51       possible to set the text to a named document. The name is looked up in
52       the text view's mime source factory. If a document name ends with an
53       anchor (for example, "#anchor"), the text browser automatically scrolls
54       to that position (using scrollToAnchor()). When the user clicks on a
55       hyperlink, the browser will call setSource() itself, with the link's
56       href value as argument. You can track the current source by connetion
57       to the sourceChanged() signal.
58
59       QTextBrowser provides backward() and forward() slots which you can use
60       to implement Back and Forward buttons. The home() slot sets the text to
61       the very first document displayed. The linkClicked() signal is emitted
62       when the user clicks a link.
63
64       By using QTextEdit::setMimeSourceFactory() you can provide your own
65       subclass of QMimeSourceFactory. This makes it possible to access data
66       from anywhere, for example from a network or from a database. See
67       QMimeSourceFactory::data() for details.
68
69       If you intend using the mime factory to read the data directly from the
70       file system, you may have to specify the encoding for the file
71       extension you are using. For example:
72
73           mimeSourceFactory()->setExtensionType("qml", "text/utf8");
74       This is to ensure that the factory is able to resolve the document
75       names.
76
77       QTextBrowser interprets the tags it processes in accordance with the
78       default style sheet. Change the style sheet with setStyleSheet(); see
79       QStyleSheet for details.
80
81       If you want to provide your users with editable rich text use
82       QTextEdit. If you want a text browser without hypertext navigation use
83       QTextEdit, and use QTextEdit::setReadOnly() to disable editing. If you
84       just need to display a small piece of rich text use QSimpleRichText or
85       QLabel.
86
87                                   [Image Omitted]
88
89                                   [Image Omitted]
90
91       See also Advanced Widgets, Help System, and Text Related Classes.
92

MEMBER FUNCTION DOCUMENTATION

QTextBrowser::QTextBrowser ( QWidget * parent = 0, const char * name = 0 )

95       Constructs an empty QTextBrowser called name, with parent parent.
96
98       ) [signal]
99       This signal is emitted when the user clicks an anchor. The link is the
100       value of the href i.e. the name of the target document. The name is the
101       name of the anchor.
102
103       See also linkClicked().
104

void QTextBrowser::backward () [virtual slot]

106       Changes the document displayed to the previous document in the list of
107       documents built by navigating links. Does nothing if there is no
108       previous document.
109
110       See also forward() and backwardAvailable().
111
112       Example: helpviewer/helpwindow.cpp.
113

void QTextBrowser::backwardAvailable ( bool available ) [signal]

115       This signal is emitted when the availability of backward() changes.
116       available is FALSE when the user is at home(); otherwise it is TRUE.
117
118       Example: helpviewer/helpwindow.cpp.
119

void QTextBrowser::forward () [virtual slot]

121       Changes the document displayed to the next document in the list of
122       documents built by navigating links. Does nothing if there is no next
123       document.
124
125       See also backward() and forwardAvailable().
126
127       Example: helpviewer/helpwindow.cpp.
128

void QTextBrowser::forwardAvailable ( bool available ) [signal]

130       This signal is emitted when the availability of forward() changes.
131       available is TRUE after the user navigates backward() and FALSE when
132       the user navigates or goes forward().
133
134       Example: helpviewer/helpwindow.cpp.
135
137       This signal is emitted when the user has selected but not activated a
138       link in the document. link is the value of the href i.e. the name of
139       the target document.
140
141       Example: helpviewer/helpwindow.cpp.
142

void QTextBrowser::home () [virtual slot]

144       Changes the document displayed to be the first document the browser
145       displayed.
146
147       Example: helpviewer/helpwindow.cpp.
148

void QTextBrowser::keyPressEvent ( QKeyEvent * e ) [virtual protected]

150       The event e is used to provide the following keyboard shortcuts:
151       <center>.nf
152
153       </center>
154
155       Reimplemented from QTextEdit.
156
158       This signal is emitted when the user clicks a link. The link is the
159       value of the href i.e. the name of the target document.
160
161       The link will be the absolute location of the document, based on the
162       value of the anchor's href tag and the current context of the document.
163
164       See also anchorClicked() and context().
165

void QTextBrowser::reload () [virtual slot]

167       Reloads the current set source.
168

void QTextBrowser::setSource ( const QString & name ) [virtual slot]

170       Sets the name of the displayed document to name. See the "source"
171       property for details.
172

QString QTextBrowser::source () const

174       Returns the name of the displayed document. See the "source" property
175       for details.
176

void QTextBrowser::sourceChanged ( const QString & src ) [signal]

178       This signal is emitted when the mime source has changed, src being the
179       new source.
180
181       Source changes happen both programmatically when calling setSource(),
182       forward(), backword() or home() or when the user clicks on links or
183       presses the equivalent key sequences.
184
185       Example: helpviewer/helpwindow.cpp.
186
187   Property Documentation

bool modified

189       This property holds whether the contents have been modified.
190

bool overwriteMode

192       This property holds this text browser's overwrite mode.
193

bool readOnly

195       This property holds whether the contents are read only.
196

QString source

198       This property holds the name of the displayed document.
199
200       This is a QString::null if no document is displayed or if the source is
201       unknown.
202
203       Setting this property uses the mimeSourceFactory() to lookup the named
204       document. It also checks for optional anchors and scrolls the document
205       accordingly.
206
207       If the first tag in the document is <qt type=detail>, the document is
208       displayed as a popup rather than as new document in the browser window
209       itself. Otherwise, the document is displayed normally in the text
210       browser with the text set to the contents of the named document with
211       setText().
212
213       If you are using the filesystem access capabilities of the mime source
214       factory, you must ensure that the factory knows about the encoding of
215       specified files; otherwise no data will be available. The default
216       factory handles a couple of common file extensions such as *.html and
217       *.txt with reasonable defaults. See QMimeSourceFactory::data() for
218       details.
219
220       Set this property's value with setSource() and get this property's
221       value with source().
222

int undoDepth

224       This property holds this text browser's undo depth.
225

bool undoRedoEnabled

227       This property holds whether undo and redo are enabled.
228

SEE ALSO

230       http://doc.trolltech.com/qtextbrowser.html
231       http://www.trolltech.com/faq/tech.html
232
234       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
235       license file included in the distribution for a complete license
236       statement.
237

AUTHOR

239       Generated automatically from the source code.
240

BUGS

242       If you find a bug in Qt, please report it as described in
243       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
244       help you. Thank you.
245
246       The definitive Qt documentation is provided in HTML format; it is
247       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
248       web browser. This man page is provided as a convenience for those users
249       who prefer man pages, although this format is not officially supported
250       by Trolltech.
251
252       If you find errors in this manual page, please report them to qt-
253       bugs@trolltech.com.  Please include the name of the manual page
254       (qtextbrowser.3qt) and the Qt version (3.3.8).
255
256
257
258Trolltech AS                    2 February 2007              QTextBrowser(3qt)
Impressum