📄 qstylesheet.html
字号:
</ul></table></center><p> Special elements are:<center><table cellpadding="4" cellspacing="2" border="0"><tr bgcolor="#a2c511"> <th valign="top">Special tags <th valign="top">Notes<tr bgcolor="#d0d0d0"> <td valign="top"><tt><img></tt><td valign="top">An image. The image name for the mime source factory isgiven in the source attribute, for example<tt><img src="qt.xpm"></tt> The image tag also understands theattributes <tt>width</tt> and <tt>height</tt> that determine the sizeof the image. If the pixmap does not fit the specifiedsize it will be scaled automatically (by using<a href="qimage.html#smoothScale">QImage::smoothScale</a>()).<br>The <tt>align</tt> attribute determines where the image isplaced. By default, an image is placed inline just like anormal character. Specify <tt>left</tt> or <tt>right</tt> to place theimage at the respective side.<tr bgcolor="#f0f0f0"> <td valign="top"><tt><hr></tt><td valign="top">A horizonal line.<tr bgcolor="#d0d0d0"> <td valign="top"><tt><br></tt><td valign="top">A line break.<tr bgcolor="#f0f0f0"> <td valign="top"><tt><nobr>...</nobr></tt><td valign="top">No break. Prevents word wrap.</table></center><p> In addition, rich text supports simple HTML tables. A tableconsists of one or more rows each of which contains one or morecells. Cells are either data cells or header cells, depending ontheir content. Cells which span rows and columns are supported.<p> <center><table cellpadding="4" cellspacing="2" border="0"><tr bgcolor="#a2c511"> <th valign="top">Table tags <th valign="top">Notes<tr bgcolor="#d0d0d0"> <td valign="top"><tt><table>...</table></tt><td valign="top">A table. Tables support the following attributes:<ul><li> <tt>bgcolor</tt> -- The background color.<li> <tt>width</tt> -- The table width. This is either an absolutepixel width or a relative percentage of the table'swidth, for example <tt>width=80%</tt>.<li> <tt>border</tt> -- The width of the table border. The default is0 (= no border).<li> <tt>cellspacing</tt> -- Additional space around the table cells.The default is 2.<li> <tt>cellpadding</tt> -- Additional space around the contents oftable cells. The default is 1.</ul><tr bgcolor="#f0f0f0"> <td valign="top"><tt><tr>...</tr></tt><td valign="top">A table row. This is only valid within a <tt>table</tt>. Rowssupport the following attribute:<ul><li> <tt>bgcolor</tt> -- The background color.</ul><tr bgcolor="#d0d0d0"> <td valign="top"><tt><th>...</th></tt><td valign="top">A table header cell. Similar to <tt>td</tt>, but defaults tocenter alignment and a bold font.<tr bgcolor="#f0f0f0"> <td valign="top"><tt><td>...</td></tt><td valign="top">A table data cell. This is only valid within a <tt>tr</tt>.Cells support the following attributes:<ul><li> <tt>bgcolor</tt> -- The background color.<li> <tt>width</tt> -- The cell width. This is either an absolutepixel width or a relative percentage of table's width,for example <tt>width=50%</tt>.<li> <tt>colspan</tt> -- Specifies how many columns this cell spans.The default is 1.<li> <tt>rowspan</tt> -- Specifies how many rows this cell spans. Thedefault is 1.<li> <tt>align</tt> -- Alignment; possible values are <tt>left</tt>, <tt>right</tt>, and <tt>center</tt>. The default is left.</ul></table></center><p>See also <a href="graphics.html">Graphics Classes</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="QStyleSheet"></a>QStyleSheet::QStyleSheet ( <a href="qobject.html">QObject</a> * parent = 0, const char * name = 0 )</h3>Creates a style sheet called <em>name</em>, with parent <em>parent</em>. Likeany <a href="qobject.html">QObject</a> it will be deleted when its parent is destroyed (ifthe child still exists).<p> By default the style sheet has the tag definitions defined above.<h3 class=fn><a name="~QStyleSheet"></a>QStyleSheet::~QStyleSheet ()<tt> [virtual]</tt></h3>Destroys the style sheet. All styles inserted into the style sheetwill be deleted.<h3 class=fn><a href="qstring.html">QString</a> <a name="convertFromPlainText"></a>QStyleSheet::convertFromPlainText ( const <a href="qstring.html">QString</a> & plain, <a href="qstylesheetitem.html#WhiteSpaceMode-enum">QStyleSheetItem::WhiteSpaceMode</a> mode = QStyleSheetItem::WhiteSpacePre )<tt> [static]</tt></h3> Auxiliary function. Converts the plain text string <em>plain</em> to arich text formatted paragraph while preserving most of its look.<p> <em>mode</em> defines the whitespace mode. Possible values are <a href="qstylesheetitem.html#WhiteSpaceMode-enum">QStyleSheetItem::WhiteSpacePre</a> (no wrapping, all whitespacespreserved) and <a href="qstylesheetitem.html#WhiteSpaceMode-enum">QStyleSheetItem::WhiteSpaceNormal</a> (wrapping,simplified whitespaces).<p> <p>See also <a href="#escape">escape</a>().<h3 class=fn><a href="qstylesheet.html">QStyleSheet</a> * <a name="defaultSheet"></a>QStyleSheet::defaultSheet ()<tt> [static]</tt></h3>Returns the application-wide default style sheet. This style sheetis used by rich text rendering classes such as <a href="qsimplerichtext.html">QSimpleRichText</a>,<a href="qwhatsthis.html">QWhatsThis</a> and <a href="qmessagebox.html">QMessageBox</a> to define the rendering style andavailable tags within rich text documents. It also serves as theinitial style sheet for the more complex render widgets, <a href="qtextedit.html">QTextEdit</a>and <a href="qtextbrowser.html">QTextBrowser</a>.<p> <p>See also <a href="#setDefaultSheet">setDefaultSheet</a>().<h3 class=fn>void <a name="error"></a>QStyleSheet::error ( const <a href="qstring.html">QString</a> & msg ) const<tt> [virtual]</tt></h3><p> This virtual function is called when an error occurs whenprocessing rich text. Reimplement it if you need to catch errormessages.<p> Errors might occur if some rich text strings contain tags that arenot understood by the stylesheet, if some tags are nestedincorrectly, or if tags are not closed properly.<p> <em>msg</em> is the error message.<h3 class=fn><a href="qstring.html">QString</a> <a name="escape"></a>QStyleSheet::escape ( const <a href="qstring.html">QString</a> & plain )<tt> [static]</tt></h3>Auxiliary function. Converts the plain text string <em>plain</em> to arich text formatted string with any HTML meta-characters escaped.<p> <p>See also <a href="#convertFromPlainText">convertFromPlainText</a>().<h3 class=fn><a href="qstylesheetitem.html">QStyleSheetItem</a> * <a name="item"></a>QStyleSheet::item ( const <a href="qstring.html">QString</a> & name )</h3>Returns the style called <em>name</em> or 0 if there is no such style.<h3 class=fn>const <a href="qstylesheetitem.html">QStyleSheetItem</a> * <a name="item-2"></a>QStyleSheet::item ( const <a href="qstring.html">QString</a> & name ) const</h3>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.<p> Returns the style called <em>name</em> or 0 if there is no such style(const version)<h3 class=fn>bool <a name="mightBeRichText"></a>QStyleSheet::mightBeRichText ( const <a href="qstring.html">QString</a> & text )<tt> [static]</tt></h3>Returns TRUE if the string <em>text</em> is likely to be rich text;otherwise returns FALSE.<p> This function uses a fast and therefore simple heuristic. Itmainly checks whether there is something that looks like a tagbefore the first line break. Although the result may be correctfor common cases, there is no guarantee.<h3 class=fn>void <a name="scaleFont"></a>QStyleSheet::scaleFont ( <a href="qfont.html">QFont</a> & font, int logicalSize ) const<tt> [virtual]</tt></h3>Scales the font <em>font</em> to the appropriate physical point sizecorresponding to the logical font size <em>logicalSize</em>.<p> When calling this function, <em>font</em> has a point size correspondingto the logical font size 3.<p> Logical font sizes range from 1 to 7, with 1 being the smallest.<p> <p>See also <a href="qstylesheetitem.html#logicalFontSize">QStyleSheetItem::logicalFontSize</a>(), <a href="qstylesheetitem.html#logicalFontSizeStep">QStyleSheetItem::logicalFontSizeStep</a>() and <a href="qfont.html#setPointSize">QFont::setPointSize</a>().<h3 class=fn>void <a name="setDefaultSheet"></a>QStyleSheet::setDefaultSheet ( <a href="qstylesheet.html">QStyleSheet</a> * sheet )<tt> [static]</tt></h3>Sets the application-wide default style sheet to <em>sheet</em>,deleting any style sheet previously set. The ownership istransferred to QStyleSheet.<p> <p>See also <a href="#defaultSheet">defaultSheet</a>().<h3 class=fn>QTextCustomItem * <a name="tag"></a>QStyleSheet::tag ( const <a href="qstring.html">QString</a> & name, const <a href="qmap.html">QMap</a><QString, QString> & attr, const <a href="qstring.html">QString</a> & context, const <a href="qmimesourcefactory.html">QMimeSourceFactory</a> & factory, bool emptyTag, QTextDocument * doc ) const<tt> [virtual]</tt></h3><p><b>This function is under development and is subject to change.</b><p> Generates an internal object for the tag called <em>name</em>, given theattributes <em>attr</em>, and using additional information provided bythe mime source factory <em>factory</em>.<p> <em>context</em> is the optional context of the document, i.e. the pathto look for relative links. This becomes important if the textcontains relative references, for example within image tags.<a href="qsimplerichtext.html">QSimpleRichText</a> always uses the default mime source factory (see<a href="qmimesourcefactory.html#defaultFactory">QMimeSourceFactory::defaultFactory</a>()) to resolve thesereferences. The context will then be used to calculate theabsolute path. See <a href="qmimesourcefactory.html#makeAbsolute">QMimeSourceFactory::makeAbsolute</a>() for details.<p> <em>emptyTag</em> and <em>doc</em> are for internal use only.<p> This function should not be used in application code.<!-- 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -