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

📄 qsimplerichtext.3qt

📁 Qt/Embedded是一个多平台的C++图形用户界面应用程序框架
💻 3QT
字号:
.TH QSimpleRichText 3qt "10 November 2000" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2000 Trolltech AS.  All rights reserved.  See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQSimpleRichText \- A small displayable piece of rich text.SH SYNOPSIS.br.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 " "verticalBreak" " = -1, const QColor & linkColor = Qt::blue, bool " "linkUnderline" " = TRUE ) ".br.ti -1c.BI "\fB~QSimpleRichText\fR () ".br.ti -1c.BI "void \fBsetWidth\fR ( int ) ".br.ti -1c.BI "void \fBsetWidth\fR ( QPainter *, int ) ".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 *, int " "x" ", int " "y" ", const QRegion & " "clipRegion" ", const QPalette & " "pal" ", const QBrush * " "paper" " = 0 ) const".br.ti -1c.BI "void \fBdraw\fR ( QPainter *, int " "x" ", int " "y" ", const QRegion & " "clipRegion" ", const QColorGroup & " "cg" ", const QBrush * " "paper" " = 0 ) const".br.ti -1c.BI "QString \fBcontext\fR () const".br.ti -1c.BI "QString \fBanchorAt\fR ( const QPoint & pos ) const".br.ti -1c.BI "QString anchor ( QPainter * " "p" ", const QPoint & pos ) \fI(obsolete)\fR".br.ti -1c.BI "bool \fBinText\fR ( const QPoint & pos ) const".br.in -1c.SH DESCRIPTIONA small displayable piece of rich text..PPThis class encapsulates simple richt text usage where a string is interpreted as richt text and can be drawn. This is in particular useful if you want to display some rich text in a custom widget. A QStyleSheet is needed to actually 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 should change, just throw the rich text object away and make a new one with the new contents..PPFor large documents, see QTextView or QTextBrowser..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 basis for the text rendering. When using rich text rendering on a certain widget \fIw,\fR you would regularly specify the widget's font as shown in the following code example:.PP.nf.br  QSimpleRichText myrichtext( contents, mywidget->font() );.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..PPFinally \fIs\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 verticalBreak = -1, const QColor & linkColor = Qt::blue, bool linkUnderline = TRUE )"Another, more complex constructor for QSimpleRichText that takes an additional mime source factory \fIfactory,\fR a vertical break parameter \fIverticalBreak,\fR a link color \fIlinkColor\fR and a bool \fIlinkUnderline.\fR.PPThe constructor is useful to create a QSimpleRichText object suitable for printing. Set \fIverticalBreak\fR to be the height of the contents area of the pages..SH "QSimpleRichText::~QSimpleRichText ()"Destructs the document, freeing memory..SH "void QSimpleRichText::adjustSize ()"Adjusts the richt text document to a reasonable size..PPSee also setWidth()..SH "QString QSimpleRichText::anchor ( QPainter *, const QPoint & pos )"\fBThis function is obsolete.\fR It is provided to keep old source working, and will probably be removed in a future version of Qt. We strongly advise against using it in new code..PPReturns the anchor at the requested position. The QPainter is needed for font size calculations. An empty string is returned if no anchor is specified for this certain position..PPThis function will be removed in 3.0..SH "QString QSimpleRichText::anchorAt ( const QPoint & pos ) const"Returns the anchor at the requested position. An empty string is returned if no anchor is specified for this certain 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..SH "void QSimpleRichText::draw ( QPainter * p, int x, int y, const QRegion & clipRegion, const QPalette & pal, const QBrush * paper = 0 ) const"Draws the formatted text with \fIp,\fR at position (\fIx, y),\fR clipped to \fIclipRegion.\fR Colors from the palette \fIpal\fR are used as needed, and if not 0, *\fIpaper\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..SH "void QSimpleRichText::draw ( QPainter * p, int x, int y, const QRegion & clipRegion, const QColorGroup & cg, const QBrush * paper = 0 ) const"This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts..PPDraws the formatted text with \fIp,\fR at position (\fIx, y),\fR clipped to \fIclipRegion.\fR Colors from the \fIcg\fR are used as needed, and if not 0, *\fIpaper\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..PPThis is a convenience function if there's no palette but just a color group available. If you have a palette, pass this instead of \fIcg.\fR.SH "int QSimpleRichText::height () const"Returns the height of the document, in pixels..PPSee also setWidth()..SH "bool QSimpleRichText::inText ( const QPoint & pos ) const"Returns whether \fIpos\fR is within a text line of the document or not..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 \fIp.\fR.PPPassing a painter is useful when you intend to draw on devices other than the screen, like for example a QPrinter..PPSee also height() and adjustSize()..SH "void QSimpleRichText::setWidth ( int w )"Sets 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.SH COPYRIGHTCopyright 1992-2000 Trolltech AS, http://www.trolltech.com/.  See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code.

⌨️ 快捷键说明

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