qtextbrowser.html
来自「QT 下载资料仅供参考」· HTML 代码 · 共 210 行
HTML
210 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/reggie/tmp/qt-3.0-reggie-5401/qt-x11-commercial-3.0.5/src/widgets/qtextbrowser.cpp:59 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>QTextBrowser Class</title><style type="text/css"><!--h3.fn,span.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>QTextBrowser Class Reference</h1><p>The QTextBrowser class provides a rich text browser with hypertext navigation.<a href="#details">More...</a><p><tt>#include <<a href="qtextbrowser-h.html">qtextbrowser.h</a>></tt><p>Inherits <a href="qtextedit.html">QTextEdit</a>.<p><a href="qtextbrowser-members.html">List of all member functions.</a><h2>Public Members</h2><ul><li><div class=fn><a href="#QTextBrowser"><b>QTextBrowser</b></a> ( QWidget * parent = 0, const char * name = 0 )</div></li><li><div class=fn>QString <a href="#source"><b>source</b></a> () const</div></li></ul><h2>Public Slots</h2><ul><li><div class=fn>virtual void <a href="#setSource"><b>setSource</b></a> ( const QString & name )</div></li><li><div class=fn>virtual void <a href="#backward"><b>backward</b></a> ()</div></li><li><div class=fn>virtual void <a href="#forward"><b>forward</b></a> ()</div></li><li><div class=fn>virtual void <a href="#home"><b>home</b></a> ()</div></li><li><div class=fn>virtual void <a href="#reload"><b>reload</b></a> ()</div></li></ul><h2>Signals</h2><ul><li><div class=fn>void <a href="#backwardAvailable"><b>backwardAvailable</b></a> ( bool available )</div></li><li><div class=fn>void <a href="#forwardAvailable"><b>forwardAvailable</b></a> ( bool available )</div></li><li><div class=fn>void <a href="#highlighted"><b>highlighted</b></a> ( const QString & href )</div></li><li><div class=fn>void <a href="#linkClicked"><b>linkClicked</b></a> ( const QString & link )</div></li></ul><h2>Properties</h2><ul><li><div class=fn>QString <a href="#source-prop"><b>source</b></a> - the name of the currently displayed document</div></li></ul><h2>Protected Members</h2><ul><li><div class=fn>virtual void <a href="#keyPressEvent"><b>keyPressEvent</b></a> ( QKeyEvent * e )</div></li></ul><hr><a name="details"></a><h2>Detailed Description</h2>The QTextBrowser class provides a rich text browser with hypertext navigation.<p> This class extends <a href="qtextedit.html">QTextEdit</a> (in read-only mode), adding somenavigation functionality so that users can follow links in hypertextdocuments. The contents of QTextEdit is set with <a href="qtextedit.html#setText">setText</a>(), butQTextBrowser has an additional function, <a href="#setSource">setSource</a>(), which makes itpossible to set the text to a named document. The name is looked upin the text view's mime source factory. If a document name ends withan anchor (for example, "<tt>#anchor"</tt>), the text browserautomatically scrolls to that position (using<a href="qtextedit.html#scrollToAnchor">scrollToAnchor</a>()). When the user clicks on a hyperlink, the browserwill call setSource() itself, with the link's <tt>href</tt> value asargument.<p> QTextBrowser provides <a href="#backward">backward</a>() and <a href="#forward">forward</a>() slots which you can useto implement Back and Forward buttons. The <a href="#home">home</a>() slot sets the textto the very first document displayed. The <a href="#linkClicked">linkClicked</a>() signal isemitted when the user clicks a link.<p> By using <a href="qtextedit.html#setMimeSourceFactory">QTextEdit::setMimeSourceFactory</a>() you can provide your ownsubclass of <a href="qmimesourcefactory.html">QMimeSourceFactory</a>. This makes it possible to accessdata from anywhere, for example from a network or from adatabase. See <a href="qmimesourcefactory.html#data">QMimeSourceFactory::data</a>() for details.<p> If you intend using the mime factory to read the data directly fromthe file system, you may have to specify the encoding for the fileextension you are using. For example:<pre> <a href="qtextedit.html#mimeSourceFactory">mimeSourceFactory</a>()->setExtensionType("qml", "text/utf8"); </pre> This is to ensure that the factory is able to resolve the document names.<p> If you want to provide your users with editable rich text use<a href="qtextedit.html">QTextEdit</a>. If you want a text browser without hypertext navigationuse QTextEdit, and use <a href="qtextedit.html#setReadOnly">QTextEdit::setReadOnly</a>() to disableediting. If you just need to display a small piece of rich textuse <a href="qsimplerichtext.html">QSimpleRichText</a> or <a href="qlabel.html">QLabel</a>.<p> <img src=qtextbrowser-m.png> <img src=qtextbrowser-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="QTextBrowser"></a>QTextBrowser::QTextBrowser ( <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0 )</h3> Constructs an empty QTextBrowser with parent <em>parent</em> called <em>name</em>.<h3 class=fn>void <a name="backward"></a>QTextBrowser::backward ()<tt> [virtual slot]</tt></h3> Changes the document displayed to the previous document in thelist of documents built by navigating links. Does nothing if there isno previous document.<p> <p>See also <a href="#forward">forward</a>() and <a href="#backwardAvailable">backwardAvailable</a>().<p>Example: <a href="helpviewer-example.html#x1022">helpviewer/helpwindow.cpp</a>.<h3 class=fn>void <a name="backwardAvailable"></a>QTextBrowser::backwardAvailable ( bool available )<tt> [signal]</tt></h3> <p> This signal is emitted when the availability of the <a href="#backward">backward</a>()changes. <em>available</em> is FALSE when the user is at <a href="#home">home</a>(); otherwiseit is TRUE.<p>Example: <a href="helpviewer-example.html#x1023">helpviewer/helpwindow.cpp</a>.<h3 class=fn>void <a name="forward"></a>QTextBrowser::forward ()<tt> [virtual slot]</tt></h3> Changes the document displayed to the next document in the list ofdocuments built by navigating links. Does nothing if there is no nextdocument.<p> <p>See also <a href="#backward">backward</a>() and <a href="#forwardAvailable">forwardAvailable</a>().<p>Example: <a href="helpviewer-example.html#x1024">helpviewer/helpwindow.cpp</a>.<h3 class=fn>void <a name="forwardAvailable"></a>QTextBrowser::forwardAvailable ( bool available )<tt> [signal]</tt></h3> <p> This signal is emitted when the availability of the <a href="#forward">forward</a>() changes.<em>available</em> is TRUE after the user navigates <a href="#backward">backward</a>() andFALSE when the user navigates or goes forward().<p>Example: <a href="helpviewer-example.html#x1025">helpviewer/helpwindow.cpp</a>.<h3 class=fn>void <a name="highlighted"></a>QTextBrowser::highlighted ( const <a href="qstring.html">QString</a> & href )<tt> [signal]</tt></h3> <p> This signal is emitted when the user has selected but not activateda link in the document. <em>href</em> is the value of the href tag in thelink.<p>Example: <a href="helpviewer-example.html#x1026">helpviewer/helpwindow.cpp</a>.<h3 class=fn>void <a name="home"></a>QTextBrowser::home ()<tt> [virtual slot]</tt></h3> Changes the document displayed to be the first document thebrowser displayed.<p>Example: <a href="helpviewer-example.html#x1027">helpviewer/helpwindow.cpp</a>.<h3 class=fn>void <a name="keyPressEvent"></a>QTextBrowser::keyPressEvent ( <a href="qkeyevent.html">QKeyEvent</a> * e )<tt> [virtual protected]</tt></h3>The event <em>e</em> is used to provide the following keyboard shortcuts:<ul><li><i>Alt+Left Arrow</i> - <a href="#backward">backward</a>()<li><i>Alt+Right Arrow</i> - <a href="#forward">forward</a>()<li><i>Alt+Up Arrow</i> - <a href="#home">home</a>()</ul><p>Reimplemented from <a href="qtextedit.html#keyPressEvent">QTextEdit</a>.<h3 class=fn>void <a name="linkClicked"></a>QTextBrowser::linkClicked ( const <a href="qstring.html">QString</a> & link )<tt> [signal]</tt></h3><p> This signal is emitted when the user clicks a link. The <em>link</em> isthe value of the <tt>href</tt> i.e. the name of the target document.<p> <h3 class=fn>void <a name="reload"></a>QTextBrowser::reload ()<tt> [virtual slot]</tt></h3> Reloads the current set source <h3 class=fn>void <a name="setSource"></a>QTextBrowser::setSource ( const <a href="qstring.html">QString</a> & name )<tt> [virtual slot]</tt></h3><p>Sets the name of the currently displayed document to <em>name</em>.See the <a href="qtextbrowser.html#source-prop">"source"</a> property for details.<h3 class=fn><a href="qstring.html">QString</a> <a name="source"></a>QTextBrowser::source () const</h3><p>Returns the name of the currently displayed document.See the <a href="qtextbrowser.html#source-prop">"source"</a> property for details.<hr><h2>Property Documentation</h2><h3 class=fn><a href="qstring.html">QString</a> <a name="source-prop"></a>source</h3><p>This property holds the name of the currently displayed document.<p>This is a null string if no document is displayed orthe source is unknown.<p> Setting this property uses the mimeSourceFactory to lookup thenamed document. It also checks for optional anchors and scrolls thedocument accordingly.<p> If the first tag in the document is <tt><qt type=detail></tt>, the documentis displayed as a popup rather than as new document in the browserwindow itself. Otherwise, the document is displayed normally in thetext browser with the text set to the contents of the named documentwith <a href="qtextedit.html#setText">setText</a>().<p> If you are using the filesystem access capabilities of the mimesource factory, you must ensure that the factory knows about theencoding of specified files; otherwise no data will beavailable. The default factory handles a couple of common fileextensions such as <tt>*.html</tt> and <tt>*.txt</tt> with reasonable defaults. See<a href="qmimesourcefactory.html#data">QMimeSourceFactory::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>().<!-- eof --><hr><p>This file is part of the <a href="index.html">Qt toolkit</a>.Copyright © 1995-2002<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 © 2002 <a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a><td align=right><div align=right>Qt version 3.0.5</div></table></div></address></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?