You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
265 lines
15 KiB
265 lines
15 KiB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>TQTextBrowser Class</title>
|
|
<style type="text/css"><!--
|
|
fn { margin-left: 1cm; text-indent: -1cm; }
|
|
a:link { color: #004faf; text-decoration: none }
|
|
a:visited { color: #672967; text-decoration: none }
|
|
body { background: #ffffff; color: black; }
|
|
--></style>
|
|
</head>
|
|
<body>
|
|
|
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|
<tr bgcolor="#E5E5E5">
|
|
<td valign=center>
|
|
<a href="index.html">
|
|
<font color="#004faf">Home</font></a>
|
|
| <a href="classes.html">
|
|
<font color="#004faf">All Classes</font></a>
|
|
| <a href="mainclasses.html">
|
|
<font color="#004faf">Main Classes</font></a>
|
|
| <a href="annotated.html">
|
|
<font color="#004faf">Annotated</font></a>
|
|
| <a href="groups.html">
|
|
<font color="#004faf">Grouped Classes</font></a>
|
|
| <a href="functions.html">
|
|
<font color="#004faf">Functions</font></a>
|
|
</td>
|
|
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQTextBrowser Class Reference</h1>
|
|
|
|
<p>The TQTextBrowser class provides a rich text browser with hypertext navigation.
|
|
<a href="#details">More...</a>
|
|
<p><tt>#include <<a href="tqtextbrowser-h.html">tqtextbrowser.h</a>></tt>
|
|
<p>Inherits <a href="tqtextedit.html">TQTextEdit</a>.
|
|
<p><a href="tqtextbrowser-members.html">List of all member functions.</a>
|
|
<h2>Public Members</h2>
|
|
<ul>
|
|
<li class=fn><a href="#TQTextBrowser"><b>TQTextBrowser</b></a> ( TQWidget * parent = 0, const char * name = 0 )</li>
|
|
<li class=fn>TQString <a href="#source"><b>source</b></a> () const</li>
|
|
</ul>
|
|
<h2>Public Slots</h2>
|
|
<ul>
|
|
<li class=fn>virtual void <a href="#setSource"><b>setSource</b></a> ( const TQString & name )</li>
|
|
<li class=fn>virtual void <a href="#backward"><b>backward</b></a> ()</li>
|
|
<li class=fn>virtual void <a href="#forward"><b>forward</b></a> ()</li>
|
|
<li class=fn>virtual void <a href="#home"><b>home</b></a> ()</li>
|
|
<li class=fn>virtual void <a href="#reload"><b>reload</b></a> ()</li>
|
|
</ul>
|
|
<h2>Signals</h2>
|
|
<ul>
|
|
<li class=fn>void <a href="#backwardAvailable"><b>backwardAvailable</b></a> ( bool available )</li>
|
|
<li class=fn>void <a href="#forwardAvailable"><b>forwardAvailable</b></a> ( bool available )</li>
|
|
<li class=fn>void <a href="#sourceChanged"><b>sourceChanged</b></a> ( const TQString & src )</li>
|
|
<li class=fn>void <a href="#highlighted"><b>highlighted</b></a> ( const TQString & link )</li>
|
|
<li class=fn>void <a href="#linkClicked"><b>linkClicked</b></a> ( const TQString & link )</li>
|
|
<li class=fn>void <a href="#anchorClicked"><b>anchorClicked</b></a> ( const TQString & name, const TQString & link )</li>
|
|
</ul>
|
|
<h2>Properties</h2>
|
|
<ul>
|
|
<li class=fn>bool <a href="#modified-prop"><b>modified</b></a> - whether the contents have been modified <em>(read only)</em></li>
|
|
<li class=fn>bool <a href="#overwriteMode-prop"><b>overwriteMode</b></a> - this text browser's overwrite mode <em>(read only)</em></li>
|
|
<li class=fn>bool <a href="#readOnly-prop"><b>readOnly</b></a> - whether the contents are read only <em>(read only)</em></li>
|
|
<li class=fn>TQString <a href="#source-prop"><b>source</b></a> - the name of the displayed document</li>
|
|
<li class=fn>int <a href="#undoDepth-prop"><b>undoDepth</b></a> - this text browser's undo depth <em>(read only)</em></li>
|
|
<li class=fn>bool <a href="#undoRedoEnabled-prop"><b>undoRedoEnabled</b></a> - whether undo and redo are enabled <em>(read only)</em></li>
|
|
</ul>
|
|
<h2>Protected Members</h2>
|
|
<ul>
|
|
<li class=fn>virtual void <a href="#keyPressEvent"><b>keyPressEvent</b></a> ( TQKeyEvent * e )</li>
|
|
</ul>
|
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
|
|
|
|
|
The TQTextBrowser class provides a rich text browser with hypertext navigation.
|
|
<p>
|
|
|
|
|
|
|
|
<p> This class extends <a href="tqtextedit.html">TQTextEdit</a> (in read-only mode), adding some
|
|
navigation functionality so that users can follow links in
|
|
hypertext documents. The contents of TQTextEdit is set with
|
|
<a href="tqtextedit.html#setText">setText</a>(), but TQTextBrowser has an additional function,
|
|
<a href="#setSource">setSource</a>(), 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, "<tt>#anchor"</tt>), the text browser automatically scrolls to that position
|
|
(using <a href="tqtextedit.html#scrollToAnchor">scrollToAnchor</a>()). When the user clicks on a hyperlink, the
|
|
browser will call setSource() itself, with the link's <tt>href</tt>
|
|
value as argument. You can track the current source by connetion
|
|
to the <a href="#sourceChanged">sourceChanged</a>() signal.
|
|
<p> TQTextBrowser provides <a href="#backward">backward</a>() and <a href="#forward">forward</a>() slots which you can
|
|
use to implement Back and Forward buttons. The <a href="#home">home</a>() slot sets
|
|
the text to the very first document displayed. The <a href="#linkClicked">linkClicked</a>()
|
|
signal is emitted when the user clicks a link.
|
|
<p> By using <a href="tqtextedit.html#setMimeSourceFactory">TQTextEdit::setMimeSourceFactory</a>() you can provide your
|
|
own subclass of <a href="tqmimesourcefactory.html">TQMimeSourceFactory</a>. This makes it possible to
|
|
access data from anywhere, for example from a network or from a
|
|
database. See <a href="tqmimesourcefactory.html#data">TQMimeSourceFactory::data</a>() for details.
|
|
<p> 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:
|
|
<pre>
|
|
<a href="tqtextedit.html#mimeSourceFactory">mimeSourceFactory</a>()->setExtensionType("qml", "text/utf8");
|
|
</pre>
|
|
|
|
This is to ensure that the factory is able to resolve the document
|
|
names.
|
|
<p> TQTextBrowser interprets the tags it processes in accordance with
|
|
the default style sheet. Change the style sheet with
|
|
<a href="tqtextedit.html#setStyleSheet">setStyleSheet</a>(); see <a href="tqstylesheet.html">TQStyleSheet</a> for details.
|
|
<p> If you want to provide your users with editable rich text use
|
|
<a href="tqtextedit.html">TQTextEdit</a>. If you want a text browser without hypertext navigation
|
|
use TQTextEdit, and use <a href="tqtextedit.html#setReadOnly">TQTextEdit::setReadOnly</a>() to disable
|
|
editing. If you just need to display a small piece of rich text
|
|
use <a href="tqsimplerichtext.html">TQSimpleRichText</a> or <a href="tqlabel.html">TQLabel</a>.
|
|
<p> <img src=tqtextbrowser-m.png> <img src=tqtextbrowser-w.png>
|
|
<p>See also <a href="advanced.html">Advanced Widgets</a>, <a href="helpsystem.html">Help System</a>, and <a href="text.html">Text Related Classes</a>.
|
|
|
|
<hr><h2>Member Function Documentation</h2>
|
|
<h3 class=fn><a name="TQTextBrowser"></a>TQTextBrowser::TQTextBrowser ( <a href="tqwidget.html">TQWidget</a> * parent = 0, const char * name = 0 )
|
|
</h3>
|
|
Constructs an empty TQTextBrowser called <em>name</em>, with parent <em>parent</em>.
|
|
|
|
<h3 class=fn>void <a name="anchorClicked"></a>TQTextBrowser::anchorClicked ( const <a href="tqstring.html">TQString</a> & name, const <a href="tqstring.html">TQString</a> & link )<tt> [signal]</tt>
|
|
</h3>
|
|
|
|
<p> This signal is emitted when the user clicks an anchor. The <em>link</em> is
|
|
the value of the <tt>href</tt> i.e. the name of the target document. The <em>name</em>
|
|
is the name of the anchor.
|
|
<p> <p>See also <a href="#linkClicked">linkClicked</a>().
|
|
|
|
<h3 class=fn>void <a name="backward"></a>TQTextBrowser::backward ()<tt> [virtual slot]</tt>
|
|
</h3>
|
|
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.
|
|
<p> <p>See also <a href="#forward">forward</a>() and <a href="#backwardAvailable">backwardAvailable</a>().
|
|
|
|
<p>Example: <a href="helpviewer-example.html#x1019">helpviewer/helpwindow.cpp</a>.
|
|
<h3 class=fn>void <a name="backwardAvailable"></a>TQTextBrowser::backwardAvailable ( bool available )<tt> [signal]</tt>
|
|
</h3>
|
|
|
|
<p> This signal is emitted when the availability of <a href="#backward">backward</a>()
|
|
changes. <em>available</em> is FALSE when the user is at <a href="#home">home</a>();
|
|
otherwise it is TRUE.
|
|
|
|
<p>Example: <a href="helpviewer-example.html#x1020">helpviewer/helpwindow.cpp</a>.
|
|
<h3 class=fn>void <a name="forward"></a>TQTextBrowser::forward ()<tt> [virtual slot]</tt>
|
|
</h3>
|
|
Changes the document displayed to the next document in the list of
|
|
documents built by navigating links. Does nothing if there is no
|
|
next document.
|
|
<p> <p>See also <a href="#backward">backward</a>() and <a href="#forwardAvailable">forwardAvailable</a>().
|
|
|
|
<p>Example: <a href="helpviewer-example.html#x1021">helpviewer/helpwindow.cpp</a>.
|
|
<h3 class=fn>void <a name="forwardAvailable"></a>TQTextBrowser::forwardAvailable ( bool available )<tt> [signal]</tt>
|
|
</h3>
|
|
|
|
<p> This signal is emitted when the availability of <a href="#forward">forward</a>() changes.
|
|
<em>available</em> is TRUE after the user navigates <a href="#backward">backward</a>() and FALSE
|
|
when the user navigates or goes forward().
|
|
|
|
<p>Example: <a href="helpviewer-example.html#x1022">helpviewer/helpwindow.cpp</a>.
|
|
<h3 class=fn>void <a name="highlighted"></a>TQTextBrowser::highlighted ( const <a href="tqstring.html">TQString</a> & link )<tt> [signal]</tt>
|
|
</h3>
|
|
<p> This signal is emitted when the user has selected but not
|
|
activated a link in the document. <em>link</em> is the value of the <tt>href</tt> i.e. the name of the target document.
|
|
|
|
<p>Example: <a href="helpviewer-example.html#x1023">helpviewer/helpwindow.cpp</a>.
|
|
<h3 class=fn>void <a name="home"></a>TQTextBrowser::home ()<tt> [virtual slot]</tt>
|
|
</h3>
|
|
Changes the document displayed to be the first document the
|
|
browser displayed.
|
|
|
|
<p>Example: <a href="helpviewer-example.html#x1024">helpviewer/helpwindow.cpp</a>.
|
|
<h3 class=fn>void <a name="keyPressEvent"></a>TQTextBrowser::keyPressEvent ( <a href="tqkeyevent.html">TQKeyEvent</a> * e )<tt> [virtual protected]</tt>
|
|
</h3>
|
|
The event <em>e</em> is used to provide the following keyboard shortcuts:
|
|
<center><table cellpadding="4" cellspacing="2" border="0">
|
|
<tr bgcolor="#a2c511"> <th valign="top">Keypress <th valign="top">Action
|
|
<tr bgcolor="#f0f0f0"> <td valign="top">Alt+Left Arrow <td valign="top"><a href="#backward">backward</a>()
|
|
<tr bgcolor="#d0d0d0"> <td valign="top">Alt+Right Arrow <td valign="top"><a href="#forward">forward</a>()
|
|
<tr bgcolor="#f0f0f0"> <td valign="top">Alt+Up Arrow <td valign="top"><a href="#home">home</a>()
|
|
</table></center>
|
|
|
|
<p>Reimplemented from <a href="tqtextedit.html#keyPressEvent">TQTextEdit</a>.
|
|
<h3 class=fn>void <a name="linkClicked"></a>TQTextBrowser::linkClicked ( const <a href="tqstring.html">TQString</a> & link )<tt> [signal]</tt>
|
|
</h3>
|
|
|
|
<p> This signal is emitted when the user clicks a link. The <em>link</em> is
|
|
the value of the <tt>href</tt> i.e. the name of the target document.
|
|
<p> The <em>link</em> will be the absolute location of the document, based
|
|
on the value of the anchor's href tag and the current context of
|
|
the document.
|
|
<p> <p>See also <a href="#anchorClicked">anchorClicked</a>() and <a href="tqtextedit.html#context">context</a>().
|
|
|
|
<h3 class=fn>void <a name="reload"></a>TQTextBrowser::reload ()<tt> [virtual slot]</tt>
|
|
</h3>
|
|
Reloads the current set source.
|
|
|
|
<h3 class=fn>void <a name="setSource"></a>TQTextBrowser::setSource ( const <a href="tqstring.html">TQString</a> & name )<tt> [virtual slot]</tt>
|
|
</h3><p>Sets the name of the displayed document to <em>name</em>.
|
|
See the <a href="tqtextbrowser.html#source-prop">"source"</a> property for details.
|
|
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="source"></a>TQTextBrowser::source () const
|
|
</h3><p>Returns the name of the displayed document.
|
|
See the <a href="tqtextbrowser.html#source-prop">"source"</a> property for details.
|
|
<h3 class=fn>void <a name="sourceChanged"></a>TQTextBrowser::sourceChanged ( const <a href="tqstring.html">TQString</a> & src )<tt> [signal]</tt>
|
|
</h3>
|
|
|
|
<p> This signal is emitted when the mime source has changed, <em>src</em>
|
|
being the new source.
|
|
<p> Source changes happen both programmatically when calling
|
|
<a href="#setSource">setSource</a>(), <a href="#forward">forward</a>(), backword() or <a href="#home">home</a>() or when the user
|
|
clicks on links or presses the equivalent key sequences.
|
|
|
|
<p>Example: <a href="helpviewer-example.html#x1027">helpviewer/helpwindow.cpp</a>.
|
|
<hr><h2>Property Documentation</h2>
|
|
<h3 class=fn>bool <a name="modified-prop"></a>modified</h3>
|
|
<p>This property holds whether the contents have been modified.
|
|
<p>
|
|
<p><h3 class=fn>bool <a name="overwriteMode-prop"></a>overwriteMode</h3>
|
|
<p>This property holds this text browser's overwrite mode.
|
|
<p>
|
|
<p><h3 class=fn>bool <a name="readOnly-prop"></a>readOnly</h3>
|
|
<p>This property holds whether the contents are read only.
|
|
<p>
|
|
<p><h3 class=fn><a href="tqstring.html">TQString</a> <a name="source-prop"></a>source</h3>
|
|
<p>This property holds the name of the displayed document.
|
|
<p>This is a <a href="tqstring.html#TQString-null">TQString::null</a> if no document is displayed or if the
|
|
source is unknown.
|
|
<p> Setting this property uses the <a href="tqtextedit.html#mimeSourceFactory">mimeSourceFactory</a>() to lookup the
|
|
named document. It also checks for optional anchors and scrolls
|
|
the document accordingly.
|
|
<p> If the first tag in the document is <tt><qt type=detail></tt>, 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 <a href="tqtextedit.html#setText">setText</a>().
|
|
<p> 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 <tt>*.html</tt> and <tt>*.txt</tt> with reasonable defaults. See
|
|
<a href="tqmimesourcefactory.html#data">TQMimeSourceFactory::data</a>() for details.
|
|
|
|
<p>Set this property's value with <a href="#setSource">setSource</a>() and get this property's value with <a href="#source">source</a>().
|
|
<h3 class=fn>int <a name="undoDepth-prop"></a>undoDepth</h3>
|
|
<p>This property holds this text browser's undo depth.
|
|
<p>
|
|
<p><h3 class=fn>bool <a name="undoRedoEnabled-prop"></a>undoRedoEnabled</h3>
|
|
<p>This property holds whether undo and redo are enabled.
|
|
<p>
|
|
<p><!-- eof -->
|
|
<hr><p>
|
|
This file is part of the <a href="index.html">TQt toolkit</a>.
|
|
Copyright © 1995-2007
|
|
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
|
<table width=100% cellspacing=0 border=0><tr>
|
|
<td>Copyright © 2007
|
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
|
<td align=right><div align=right>TQt 3.3.8</div>
|
|
</table></div></address></body>
|
|
</html>
|