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

📄 qsimplerichtext.3qt

📁 linux下GUI编程工具qt的在线连接帮助手册
💻 3QT
字号:
'\" t.TH QSimpleRichText 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 NAMEQSimpleRichText \- Small displayable piece of rich text.PP\fC#include <qsimplerichtext.h>\fR.PP.SS "Public Members".in +1c.ti -1c.BI "\fBQSimpleRichText\fR ( const QString & text, const QFont & fnt, const QString & context = QString::null, const QStyleSheet * sheet = 0 )".br.ti -1c.BI "\fBQSimpleRichText\fR ( const QString & text, const QFont & fnt, const QString & context, const QStyleSheet * sheet, const QMimeSourceFactory * factory, int pageBreak = -1, const QColor & linkColor = Qt::blue, bool linkUnderline = TRUE )".br.ti -1c.BI "\fB~QSimpleRichText\fR ()".br.ti -1c.BI "void \fBsetWidth\fR ( int w )".br.ti -1c.BI "void \fBsetWidth\fR ( QPainter * p, int w )".br.ti -1c.BI "void \fBsetDefaultFont\fR ( const QFont & f )".br.ti -1c.BI "int \fBwidth\fR () const".br.ti -1c.BI "int \fBwidthUsed\fR () const".br.ti -1c.BI "int \fBheight\fR () const".br.ti -1c.BI "void \fBadjustSize\fR ()".br.ti -1c.BI "void \fBdraw\fR ( QPainter * p, int x, int y, const QRect & clipRect, const QColorGroup & cg, const QBrush * paper = 0 ) const".br.ti -1c.BI "void draw ( QPainter * p, int x, int y, const QRegion & clipRegion, const QColorGroup & cg, const QBrush * paper = 0 ) const  \fI(obsolete)\fR".br.ti -1c.BI "QString \fBcontext\fR () const".br.ti -1c.BI "QString \fBanchorAt\fR ( const QPoint & pos ) const".br.ti -1c.BI "bool \fBinText\fR ( const QPoint & pos ) const".br.in -1c.SH DESCRIPTIONThe QSimpleRichText class provides a small displayable piece of rich text..PPThis class encapsulates simple rich text usage in which a string is interpreted as rich text and can be drawn. This is particularly useful if you want to display some rich text in a custom widget. A QStyleSheet is needed actually to understand and format rich text. Qt provides a default HTML-like style sheet, but you may define custom style sheets..PPOnce created, the rich text object can be queried for its width(), height(), and the actual width used (see widthUsed()). Most importantly, it can be drawn on any given QPainter with draw(). QSimpleRichText can also be used to implement hypertext or active text facilities by using anchorAt(). A hit test through inText() makes it possible to use simple rich text for text objects in editable drawing canvases..PPOnce constructed from a string the contents cannot be changed, only resized. If the contents change, just throw the rich text object away and make a new one with the new contents..PPFor large documents use QTextEdit or QTextBrowser. For very small items of rich text you can use a QLabel..PPSee also Text Related Classes..SH MEMBER FUNCTION DOCUMENTATION.SH "QSimpleRichText::QSimpleRichText ( const QString & text, const QFont & fnt, const QString & context = QString::null, const QStyleSheet * sheet = 0 )"Constructs a QSimpleRichText from the rich text string \fItext\fR and the font \fIfnt\fR..PPThe font is used as a basis for the text rendering. When using rich text rendering on a widget \fIw\fR, you would normally specify the widget's font, for example:.PP.nf.br  QSimpleRichText myrichtext( contents, mywidget->font() );.br.fi.PP\fIcontext\fR is the optional context of the document. This becomes important if \fItext\fR contains relative references, for example within image tags. QSimpleRichText always uses the default mime source factory (see QMimeSourceFactory::defaultFactory()) to resolve those references. The context will then be used to calculate the absolute path. See QMimeSourceFactory::makeAbsolute() for details..PPThe \fIsheet\fR is an optional style sheet. If it is 0, the default style sheet will be used (see QStyleSheet::defaultSheet())..SH "QSimpleRichText::QSimpleRichText ( const QString & text, const QFont & fnt, const QString & context, const QStyleSheet * sheet, const QMimeSourceFactory * factory, int pageBreak = -1, const QColor & linkColor = Qt::blue, bool linkUnderline = TRUE )"Constructs a QSimpleRichText from the rich text string \fItext\fR and the font \fIfnt\fR..PPThis is a slightly more complex constructor for QSimpleRichText that takes an additional mime source factory \fIfactory\fR, a page break parameter \fIpageBreak\fR and a bool \fIlinkUnderline\fR. \fIlinkColor\fR is only provided for compatibility, but has no effect, as QColorGroup's QColorGroup::link() color is used now..PP\fIcontext\fR is the optional context of the document. This becomes important if \fItext\fR contains relative references, for example within image tags. QSimpleRichText always uses the default mime source factory (see QMimeSourceFactory::defaultFactory()) to resolve those references. The context will then be used to calculate the absolute path. See QMimeSourceFactory::makeAbsolute() for details..PPThe \fIsheet\fR is an optional style sheet. If it is 0, the default style sheet will be used (see QStyleSheet::defaultSheet())..PPThis constructor is useful for creating a QSimpleRichText object suitable for printing. Set \fIpageBreak\fR to be the height of the contents area of the pages..SH "QSimpleRichText::~QSimpleRichText ()"Destroys the document, freeing memory..SH "void QSimpleRichText::adjustSize ()"Adjusts the richt text document to a reasonable size..PPSee also setWidth()..SH "QString QSimpleRichText::anchorAt ( const QPoint & pos ) const"Returns the anchor at the requested position, \fIpos\fR. An empty string is returned if no anchor is specified for this position..SH "QString QSimpleRichText::context () const"Returns the context of the rich text document. If no context has been specified in the constructor, a null string is returned. The context is the path to use to look up relative links, such as image tags and anchor references..SH "void QSimpleRichText::draw ( QPainter * p, int x, int y, const QRect & clipRect, const QColorGroup & cg, const QBrush * paper = 0 ) const"Draws the formatted text with painter \fIp\fR, at position (\fIx\fR, \fIy\fR), clipped to \fIclipRect\fR. The clipping rectangle is given in the document's coordinates translated by (\fIx\fR, \fIy\fR). Colors from the color group \fIcg\fR are used as needed, and if not 0, \fI*paper\fR is used as the background brush..PPNote that the display code is highly optimized to reduce flicker, so passing a brush for \fIpaper\fR is preferable to simply clearing the area to be painted and then calling this without a brush..PPExample: helpviewer/helpwindow.cpp..SH "void QSimpleRichText::draw ( QPainter * p, int x, int y, const QRegion & clipRegion, const QColorGroup & cg, const QBrush * paper = 0 ) const"\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code..PPUse the version with clipRect instead. The region version has problems with larger documents on some platforms (on X11 regions internally are represented with 16bit coordinates)..SH "int QSimpleRichText::height () const"Returns the height of the document in pixels..PPSee also setWidth()..PPExample: helpviewer/helpwindow.cpp..SH "bool QSimpleRichText::inText ( const QPoint & pos ) const"Returns TRUE if \fIpos\fR is within a text line of the document; otherwise returns FALSE..SH "void QSimpleRichText::setDefaultFont ( const QFont & f )"Sets the default font for the document to \fIf\fR.SH "void QSimpleRichText::setWidth ( QPainter * p, int w )"Sets the width of the document to \fIw\fR pixels, recalculating the layout as if it were to be drawn with painter \fIp\fR..PPPassing a painter is useful when you intend to draw on devices other than the screen, for example a QPrinter..PPSee also height() and adjustSize()..PPExample: helpviewer/helpwindow.cpp..SH "void QSimpleRichText::setWidth ( int w )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPSets the width of the document to \fIw\fR pixels..PPSee also height() and adjustSize()..SH "int QSimpleRichText::width () const"Returns the set width of the document in pixels..PPSee also widthUsed()..SH "int QSimpleRichText::widthUsed () const"Returns the width in pixels that is actually used by the document. This can be smaller or wider than the set width..PPIt may be wider, for example, if the text contains images or non-breakable words that are already wider than the available space. It's smaller when the document only consists of lines that do not fill the width completely..PPSee also width()..SH "SEE ALSO".BR http://doc.trolltech.com/qsimplerichtext.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 (qsimplerichtext.3qt) and the Qtversion (3.0.0).

⌨️ 快捷键说明

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