⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qtextbrowser.3qt

📁 linux下GUI编程工具qt的在线连接帮助手册
💻 3QT
字号:
'\" t.TH QTextBrowser 3qt "11 October 2001" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS.  All rights reserved.  See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQTextBrowser \- Rich text browser with hypertext navigation.PP\fC#include <qtextbrowser.h>\fR.PPInherits QTextEdit..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQTextBrowser\fR ( QWidget * parent = 0, const char * name = 0 )".br.ti -1c.BI "QString \fBsource\fR () const".br.in -1c.SS "Public Slots".in +1c.ti -1c.BI "virtual void \fBsetSource\fR ( const QString & name )".br.ti -1c.BI "virtual void \fBbackward\fR ()".br.ti -1c.BI "virtual void \fBforward\fR ()".br.ti -1c.BI "virtual void \fBhome\fR ()".br.ti -1c.BI "virtual void \fBreload\fR ()".br.in -1c.SS "Signals".in +1c.ti -1c.BI "void \fBbackwardAvailable\fR ( bool available )".br.ti -1c.BI "void \fBforwardAvailable\fR ( bool available )".br.ti -1c.BI "void \fBhighlighted\fR ( const QString & href )".br.ti -1c.BI "void \fBlinkClicked\fR ( const QString & link )".br.in -1c.SS "Properties".in +1c.ti -1c.BI "QString \fBsource\fR - the name of the currently displayed document".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "virtual void \fBkeyPressEvent\fR ( QKeyEvent * e )".br.in -1c.SH DESCRIPTIONThe QTextBrowser class provides a rich text browser with hypertext navigation..PPThis class extends QTextEdit (in read-only mode), adding some navigation functionality so that users can follow links in hypertext documents. The contents of QTextEdit is set with setText(), but QTextBrowser 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..PPQTextBrowser 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..PPBy using QTextEdit::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..PPIf 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:.PP.nf.br  mimeSourceFactory()->setExtensionType("qml", "text/utf8");.br.fiThis is to ensure that the factory is able to resolve the document names..PPIf you want to provide your users with editable rich text use QTextEdit. If you want a text browser without hypertext navigation use QTextEdit, and use QTextEdit::setReadOnly() to disable editing. If you just need to display a small piece of rich text use QSimpleRichText or QLabel..PP.ce 1.B "[Image Omitted]".PP.ce 1.B "[Image Omitted]".PPSee also Advanced Widgets, Help System and Text Related Classes..SH MEMBER FUNCTION DOCUMENTATION.SH "QTextBrowser::QTextBrowser ( QWidget * parent = 0, const char * name = 0 )"Constructs an empty QTextBrowser with parent \fIparent\fR called \fIname\fR..SH "void QTextBrowser::backward ()\fC [virtual slot]\fR"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..PPSee also forward() and backwardAvailable()..PPExample: helpviewer/helpwindow.cpp..SH "void QTextBrowser::backwardAvailable ( bool available )\fC [signal]\fR"This signal is emitted when the availability of the backward() changes. \fIavailable\fR is FALSE when the user is at home(); otherwise it is TRUE..PPExample: helpviewer/helpwindow.cpp..SH "void QTextBrowser::forward ()\fC [virtual slot]\fR"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..PPSee also backward() and forwardAvailable()..PPExample: helpviewer/helpwindow.cpp..SH "void QTextBrowser::forwardAvailable ( bool available )\fC [signal]\fR"This signal is emitted when the availability of the forward() changes. \fIavailable\fR is TRUE after the user navigates backward() and FALSE when the user navigates or goes forward()..PPExample: helpviewer/helpwindow.cpp..SH "void QTextBrowser::highlighted ( const QString & href )\fC [signal]\fR"This signal is emitted when the user has selected but not activated a link in the document. \fIhref\fR is the value of the href tag in the link..PPExample: helpviewer/helpwindow.cpp..SH "void QTextBrowser::home ()\fC [virtual slot]\fR"Changes the document displayed to be the first document the browser displayed..PPExample: helpviewer/helpwindow.cpp..SH "void QTextBrowser::keyPressEvent ( QKeyEvent * e )\fC [virtual protected]\fR"The event \fIe\fR is used to provide the following keyboard shortcuts:.TP\fIAlt+Left Arrow\fR - backward().TP\fIAlt+Right Arrow\fR - forward().TP\fIAlt+Up Arrow\fR - home().PPReimplemented from QTextEdit..SH "void QTextBrowser::linkClicked ( const QString & link )\fC [signal]\fR"This signal is emitted when the user clicks a link. The \fIlink\fR is the value of the \fChref\fR i.e. the name of the target document..SH "void QTextBrowser::reload ()\fC [virtual slot]\fR"Reloads the current set source.SH "void QTextBrowser::setSource ( const QString & name )\fC [virtual slot]\fR"Sets the name of the currently displayed document to \fIname\fR. See the "source" property for details..SH "QString QTextBrowser::source () const"Returns the name of the currently displayed document. See the "source" property for details..SS "Property Documentation".SH "QString source"This property holds the name of the currently displayed document..PPThis is a null string if no document is displayed or the source is unknown..PPSetting this property uses the mimeSourceFactory to lookup the named document. It also checks for optional anchors and scrolls the document accordingly..PPIf 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()..PPIf 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..PPSet this property's value with setSource() and get this property's value with source()..SH "SEE ALSO".BR http://doc.trolltech.com/qtextbrowser.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com.  See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports help us to help you. Thank you..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qtextbrowser.3qt) and the Qtversion (3.0.0).

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -