1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qstylesheet.cpp:854 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>QStyleSheet Class</title>
|
---|
7 | <style type="text/css"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { background: #ffffff; color: black; }
|
---|
12 | --></style>
|
---|
13 | </head>
|
---|
14 | <body>
|
---|
15 |
|
---|
16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
17 | <tr bgcolor="#E5E5E5">
|
---|
18 | <td valign=center>
|
---|
19 | <a href="index.html">
|
---|
20 | <font color="#004faf">Home</font></a>
|
---|
21 | | <a href="classes.html">
|
---|
22 | <font color="#004faf">All Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main Classes</font></a>
|
---|
25 | | <a href="annotated.html">
|
---|
26 | <font color="#004faf">Annotated</font></a>
|
---|
27 | | <a href="groups.html">
|
---|
28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
29 | | <a href="functions.html">
|
---|
30 | <font color="#004faf">Functions</font></a>
|
---|
31 | </td>
|
---|
32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QStyleSheet Class Reference</h1>
|
---|
33 |
|
---|
34 | <p>The QStyleSheet class is a collection of styles for rich text
|
---|
35 | rendering and a generator of tags.
|
---|
36 | <a href="#details">More...</a>
|
---|
37 | <p><tt>#include <<a href="qstylesheet-h.html">qstylesheet.h</a>></tt>
|
---|
38 | <p>Inherits <a href="qobject.html">QObject</a>.
|
---|
39 | <p><a href="qstylesheet-members.html">List of all member functions.</a>
|
---|
40 | <h2>Public Members</h2>
|
---|
41 | <ul>
|
---|
42 | <li class=fn><a href="#QStyleSheet"><b>QStyleSheet</b></a> ( QObject * parent = 0, const char * name = 0 )</li>
|
---|
43 | <li class=fn>virtual <a href="#~QStyleSheet"><b>~QStyleSheet</b></a> ()</li>
|
---|
44 | <li class=fn>QStyleSheetItem * <a href="#item"><b>item</b></a> ( const QString & name )</li>
|
---|
45 | <li class=fn>const QStyleSheetItem * <a href="#item-2"><b>item</b></a> ( const QString & name ) const</li>
|
---|
46 | <li class=fn>virtual QTextCustomItem * <a href="#tag"><b>tag</b></a> ( const QString & name, const QMap<QString, QString> & attr, const QString & context, const QMimeSourceFactory & factory, bool emptyTag, QTextDocument * doc ) const</li>
|
---|
47 | <li class=fn>virtual void <a href="#scaleFont"><b>scaleFont</b></a> ( QFont & font, int logicalSize ) const</li>
|
---|
48 | <li class=fn>virtual void <a href="#error"><b>error</b></a> ( const QString & msg ) const</li>
|
---|
49 | </ul>
|
---|
50 | <h2>Static Public Members</h2>
|
---|
51 | <ul>
|
---|
52 | <li class=fn>QStyleSheet * <a href="#defaultSheet"><b>defaultSheet</b></a> ()</li>
|
---|
53 | <li class=fn>void <a href="#setDefaultSheet"><b>setDefaultSheet</b></a> ( QStyleSheet * sheet )</li>
|
---|
54 | <li class=fn>QString <a href="#escape"><b>escape</b></a> ( const QString & plain )</li>
|
---|
55 | <li class=fn>QString <a href="#convertFromPlainText"><b>convertFromPlainText</b></a> ( const QString & plain, QStyleSheetItem::WhiteSpaceMode mode = QStyleSheetItem::WhiteSpacePre )</li>
|
---|
56 | <li class=fn>bool <a href="#mightBeRichText"><b>mightBeRichText</b></a> ( const QString & text )</li>
|
---|
57 | </ul>
|
---|
58 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
59 |
|
---|
60 |
|
---|
61 |
|
---|
62 | The QStyleSheet class is a collection of styles for rich text
|
---|
63 | rendering and a generator of tags.
|
---|
64 | <p>
|
---|
65 |
|
---|
66 | <p> By creating <a href="qstylesheetitem.html">QStyleSheetItem</a> objects for a style sheet you build a
|
---|
67 | definition of a set of tags. This definition will be used by the
|
---|
68 | internal rich text rendering system to parse and display text
|
---|
69 | documents to which the style sheet applies. Rich text is normally
|
---|
70 | visualized in a <a href="qtextedit.html">QTextEdit</a> or a <a href="qtextbrowser.html">QTextBrowser</a>. However, <a href="qlabel.html">QLabel</a>,
|
---|
71 | <a href="qwhatsthis.html">QWhatsThis</a> and <a href="qmessagebox.html">QMessageBox</a> also support it, and other classes are
|
---|
72 | likely to follow. With <a href="qsimplerichtext.html">QSimpleRichText</a> it is possible to use the
|
---|
73 | rich text renderer for custom widgets as well.
|
---|
74 | <p> The default QStyleSheet object has the following style bindings,
|
---|
75 | sorted by structuring bindings, anchors, character style bindings
|
---|
76 | (i.e. inline styles), special elements such as horizontal lines or
|
---|
77 | images, and other tags. In addition, rich text supports simple
|
---|
78 | HTML tables.
|
---|
79 | <p> The structuring tags are
|
---|
80 | <center><table cellpadding="4" cellspacing="2" border="0">
|
---|
81 | <tr bgcolor="#a2c511"> <th valign="top">Structuring tags <th valign="top">Notes
|
---|
82 | <tr bgcolor="#f0f0f0"> <td valign="top"><tt><qt></tt>...<tt></qt></tt>
|
---|
83 | <td valign="top">A Qt rich text document. It understands the following
|
---|
84 | attributes:
|
---|
85 | <ul>
|
---|
86 | <li> <tt>title</tt> -- The caption of the document. This attribute is
|
---|
87 | easily accessible with <a href="qtextedit.html#documentTitle">QTextEdit::documentTitle</a>().
|
---|
88 | <li> <tt>type</tt> -- The type of the document. The default type is <tt>page</tt>. It indicates that the document is displayed in a
|
---|
89 | page of its own. Another style is <tt>detail</tt>, which can be
|
---|
90 | used to explain certain expressions in more detail in a
|
---|
91 | few sentences. For <tt>detail</tt>, <a href="qtextbrowser.html">QTextBrowser</a> will then keep
|
---|
92 | the current page and display the new document in a small
|
---|
93 | popup similar to <a href="qwhatsthis.html">QWhatsThis</a>. Note that links will not work
|
---|
94 | in documents with <tt><qt type="detail">...</qt></tt>.
|
---|
95 | <li> <tt>bgcolor</tt> -- The background color, for example <tt>bgcolor="yellow"</tt> or <tt>bgcolor="#0000FF"</tt>.
|
---|
96 | <li> <tt>background</tt> -- The background pixmap, for example <tt>background="granite.xpm"</tt>. The pixmap name will be resolved
|
---|
97 | by a <a href="qmimesourcefactory.html">QMimeSourceFactory</a>().
|
---|
98 | <li> <tt>text</tt> -- The default text color, for example <tt>text="red"</tt>.
|
---|
99 | <li> <tt>link</tt> -- The link color, for example <tt>link="green"</tt>.
|
---|
100 | </ul>
|
---|
101 | <tr bgcolor="#d0d0d0"> <td valign="top"><tt><h1>...</h1></tt>
|
---|
102 | <td valign="top">A top-level heading.
|
---|
103 | <tr bgcolor="#f0f0f0"> <td valign="top"><tt><h2>...</h2></tt>
|
---|
104 | <td valign="top">A sublevel heading.
|
---|
105 | <tr bgcolor="#d0d0d0"> <td valign="top"><tt><h3>...</h3></tt>
|
---|
106 | <td valign="top">A sub-sublevel heading.
|
---|
107 | <tr bgcolor="#f0f0f0"> <td valign="top"><tt><h4>...</h4></tt> <tt><h5>...</h5></tt>
|
---|
108 | <td valign="top">Headings of lesser importance.
|
---|
109 | <tr bgcolor="#d0d0d0"> <td valign="top"><tt><p>...</p></tt>
|
---|
110 | <td valign="top">A left-aligned paragraph. Adjust the alignment with the <tt>align</tt> attribute. Possible values are <tt>left</tt>, <tt>right</tt> and
|
---|
111 | <tt>center</tt>.
|
---|
112 | <tr bgcolor="#f0f0f0"> <td valign="top"><tt><center>...</tt><br><tt></center></tt>
|
---|
113 | <td valign="top">A centered paragraph.
|
---|
114 | <tr bgcolor="#d0d0d0"> <td valign="top"><tt><blockquote>...</tt><br><tt></blockquote></tt>
|
---|
115 | <td valign="top">An indented paragraph that is useful for quotes.
|
---|
116 | <tr bgcolor="#f0f0f0"> <td valign="top"><tt><ul>...</ul></tt>
|
---|
117 | <td valign="top">An unordered list. You can also pass a type argument to
|
---|
118 | define the bullet style. The default is <tt>type=disc</tt>;
|
---|
119 | other types are <tt>circle</tt> and <tt>square</tt>.
|
---|
120 | <tr bgcolor="#d0d0d0"> <td valign="top"><tt><ol>...</ol></tt>
|
---|
121 | <td valign="top">An ordered list. You can also pass a type argument to
|
---|
122 | define the enumeration label style. The default is <tt>type="1"</tt>; other types are <tt>"a"</tt> and <tt>"A"</tt>.
|
---|
123 | <tr bgcolor="#f0f0f0"> <td valign="top"><tt><li>...</li></tt>
|
---|
124 | <td valign="top">A list item. This tag can be used only within the context
|
---|
125 | of <tt><ol></tt> or <tt><ul></tt>.
|
---|
126 | <tr bgcolor="#d0d0d0"> <td valign="top"><tt><dl>...</dl></tt>
|
---|
127 | <td valign="top">A list of definitions, consisting of terms and descriptions.
|
---|
128 | <tr bgcolor="#f0f0f0"> <td valign="top"><tt><dt>...</dt></tt>
|
---|
129 | <td valign="top">A term in a list of definitions. This tag can be used only
|
---|
130 | in the context of <tt><dl>...</dl></tt>.
|
---|
131 | <tr bgcolor="#d0d0d0"> <td valign="top"><tt><dd>...</dd></tt>
|
---|
132 | <td valign="top">A description in a list of definitions. This tag can be
|
---|
133 | used only in the context of <tt><dl>...</dl></tt>.
|
---|
134 | <tr bgcolor="#f0f0f0"> <td valign="top"><tt><pre>...</pre></tt>
|
---|
135 | <td valign="top">For larger chunks of code. Whitespaces in the contents are
|
---|
136 | preserved. For small bits of code use the inline-style <tt>code</tt>.
|
---|
137 | <tr bgcolor="#d0d0d0"> <td valign="top"><tt><div>...</div></tt> and <tt><span>...</span></tt>
|
---|
138 | <td valign="top">Block grouping elements. These are used to structure the
|
---|
139 | document, and are often used to provide hints about the
|
---|
140 | intended presentation of the document.
|
---|
141 | </table></center>
|
---|
142 | <p> Anchors and links are done with a single tag:
|
---|
143 | <center><table cellpadding="4" cellspacing="2" border="0">
|
---|
144 | <tr bgcolor="#a2c511"> <th valign="top">Anchor tags <th valign="top">Notes
|
---|
145 | <tr bgcolor="#f0f0f0"> <td valign="top"><tt><a>...</a></tt>
|
---|
146 | <td valign="top">An anchor or link.
|
---|
147 | <ul>
|
---|
148 | <li> A link is created by using an <tt>href</tt>
|
---|
149 | attribute, for example
|
---|
150 | <br><tt><a href="target.qml">Link Text</a></tt>. Links to
|
---|
151 | targets within a document are achieved in the same way
|
---|
152 | as for HTML, e.g.
|
---|
153 | <br><tt><a href="target.qml#subtitle">Link Text</a></tt>.
|
---|
154 | <li> A target is created by using a <a href="qobject.html#name-prop">name</a>
|
---|
155 | attribute, for example
|
---|
156 | <br><tt><a name="subtitle"><h2>Sub Title</h2></a></tt>.
|
---|
157 | </ul>
|
---|
158 | </table></center>
|
---|
159 | <p> The default character style bindings are
|
---|
160 | <center><table cellpadding="4" cellspacing="2" border="0">
|
---|
161 | <tr bgcolor="#a2c511"> <th valign="top">Style tags <th valign="top">Notes
|
---|
162 | <tr bgcolor="#d0d0d0"> <td valign="top"><tt><em>...</em></tt>
|
---|
163 | <td valign="top">Emphasized. By default this is the same as <tt><i>...</i></tt>
|
---|
164 | (italic).
|
---|
165 | <tr bgcolor="#f0f0f0"> <td valign="top"><tt><strong>...</strong></tt>
|
---|
166 | <td valign="top">Strong. By default this is the same as <tt><b>...</b></tt>
|
---|
167 | (bold).
|
---|
168 | <tr bgcolor="#d0d0d0"> <td valign="top"><tt><i>...</i></tt>
|
---|
169 | <td valign="top">Italic font style.
|
---|
170 | <tr bgcolor="#f0f0f0"> <td valign="top"><tt><b>...</b></tt>
|
---|
171 | <td valign="top">Bold font style.
|
---|
172 | <tr bgcolor="#d0d0d0"> <td valign="top"><tt><u>...</u></tt>
|
---|
173 | <td valign="top">Underlined font style.
|
---|
174 | <tr bgcolor="#f0f0f0"> <td valign="top"><tt><s>...</s></tt>
|
---|
175 | <td valign="top">Strike out font style.
|
---|
176 | <tr bgcolor="#d0d0d0"> <td valign="top"><tt><big>...</big></tt>
|
---|
177 | <td valign="top">A larger font size.
|
---|
178 | <tr bgcolor="#f0f0f0"> <td valign="top"><tt><small>...</small></tt>
|
---|
179 | <td valign="top">A smaller font size.
|
---|
180 | <tr bgcolor="#d0d0d0"> <td valign="top"><tt><sub>...</sub></tt>
|
---|
181 | <td valign="top">Subscripted text
|
---|
182 | <tr bgcolor="#f0f0f0"> <td valign="top"><tt><sup>...</sup></tt>
|
---|
183 | <td valign="top">Superscripted text
|
---|
184 | <tr bgcolor="#d0d0d0"> <td valign="top"><tt><code>...</code></tt>
|
---|
185 | <td valign="top">Indicates code. By default this is the same as
|
---|
186 | <tt><tt>...</tt></tt> (typewriter). For larger chunks of code
|
---|
187 | use the block-tag <tt><</tt><tt>pre></tt>.
|
---|
188 | <tr bgcolor="#f0f0f0"> <td valign="top"><tt><tt>...</tt></tt>
|
---|
189 | <td valign="top">Typewriter font style.
|
---|
190 | <tr bgcolor="#d0d0d0"> <td valign="top"><tt><font>...</font></tt>
|
---|
191 | <td valign="top">Customizes the font size, family and text color. The tag
|
---|
192 | understands the following attributes:
|
---|
193 | <ul>
|
---|
194 | <li> <tt>color</tt> -- The text color, for example <tt>color="red"</tt> or
|
---|
195 | <tt>color="#FF0000"</tt>.
|
---|
196 | <li> <tt>size</tt> -- The logical size of the font. Logical sizes 1
|
---|
197 | to 7 are supported. The value may either be absolute
|
---|
198 | (for example, <tt>size=3</tt>) or relative (<tt>size=-2</tt>). In
|
---|
199 | the latter case the sizes are simply added.
|
---|
200 | <li> <tt>face</tt> -- The family of the font, for example <tt>face=times</tt>.
|
---|
201 | </ul>
|
---|
202 | </table></center>
|
---|
203 | <p> Special elements are:
|
---|
204 | <center><table cellpadding="4" cellspacing="2" border="0">
|
---|
205 | <tr bgcolor="#a2c511"> <th valign="top">Special tags <th valign="top">Notes
|
---|
206 | <tr bgcolor="#f0f0f0"> <td valign="top"><tt><img></tt>
|
---|
207 | <td valign="top">An image. The image name for the mime source factory is
|
---|
208 | given in the source attribute, for example
|
---|
209 | <tt><img src="qt.xpm"></tt> The image tag also understands the
|
---|
210 | attributes <tt>width</tt> and <tt>height</tt> that determine the size
|
---|
211 | of the image. If the pixmap does not fit the specified
|
---|
212 | size it will be scaled automatically (by using
|
---|
213 | <a href="qimage.html#smoothScale">QImage::smoothScale</a>()).
|
---|
214 | <br>
|
---|
215 | The <tt>align</tt> attribute determines where the image is
|
---|
216 | placed. By default, an image is placed inline just like a
|
---|
217 | normal character. Specify <tt>left</tt> or <tt>right</tt> to place the
|
---|
218 | image at the respective side.
|
---|
219 | <tr bgcolor="#d0d0d0"> <td valign="top"><tt><hr></tt>
|
---|
220 | <td valign="top">A horizontal line.
|
---|
221 | <tr bgcolor="#f0f0f0"> <td valign="top"><tt><br></tt>
|
---|
222 | <td valign="top">A line break.
|
---|
223 | <tr bgcolor="#d0d0d0"> <td valign="top"><tt><nobr>...</nobr></tt>
|
---|
224 | <td valign="top">No break. Prevents word wrap.
|
---|
225 | </table></center>
|
---|
226 | <p> In addition, rich text supports simple HTML tables. A table
|
---|
227 | consists of one or more rows each of which contains one or more
|
---|
228 | cells. Cells are either data cells or header cells, depending on
|
---|
229 | their content. Cells which span rows and columns are supported.
|
---|
230 | <p> <center><table cellpadding="4" cellspacing="2" border="0">
|
---|
231 | <tr bgcolor="#a2c511"> <th valign="top">Table tags <th valign="top">Notes
|
---|
232 | <tr bgcolor="#f0f0f0"> <td valign="top"><tt><table>...</table></tt>
|
---|
233 | <td valign="top">A table. Tables support the following attributes:
|
---|
234 | <ul>
|
---|
235 | <li> <tt>bgcolor</tt> -- The background color.
|
---|
236 | <li> <tt>width</tt> -- The table width. This is either an absolute
|
---|
237 | pixel width or a relative percentage of the table's
|
---|
238 | width, for example <tt>width=80%</tt>.
|
---|
239 | <li> <tt>border</tt> -- The width of the table border. The default is
|
---|
240 | 0 (= no border).
|
---|
241 | <li> <tt>cellspacing</tt> -- Additional space around the table cells.
|
---|
242 | The default is 2.
|
---|
243 | <li> <tt>cellpadding</tt> -- Additional space around the contents of
|
---|
244 | table cells. The default is 1.
|
---|
245 | </ul>
|
---|
246 | <tr bgcolor="#d0d0d0"> <td valign="top"><tt><tr>...</tr></tt>
|
---|
247 | <td valign="top">A table row. This is only valid within a <tt>table</tt>. Rows
|
---|
248 | support the following attribute:
|
---|
249 | <ul>
|
---|
250 | <li> <tt>bgcolor</tt> -- The background color.
|
---|
251 | </ul>
|
---|
252 | <tr bgcolor="#f0f0f0"> <td valign="top"><tt><th>...</th></tt>
|
---|
253 | <td valign="top">A table header cell. Similar to <tt>td</tt>, but defaults to
|
---|
254 | center alignment and a bold font.
|
---|
255 | <tr bgcolor="#d0d0d0"> <td valign="top"><tt><td>...</td></tt>
|
---|
256 | <td valign="top">A table data cell. This is only valid within a <tt>tr</tt>.
|
---|
257 | Cells support the following attributes:
|
---|
258 | <ul>
|
---|
259 | <li> <tt>bgcolor</tt> -- The background color.
|
---|
260 | <li> <tt>width</tt> -- The cell width. This is either an absolute
|
---|
261 | pixel width or a relative percentage of table's width,
|
---|
262 | for example <tt>width=50%</tt>.
|
---|
263 | <li> <tt>colspan</tt> -- Specifies how many columns this cell spans.
|
---|
264 | The default is 1.
|
---|
265 | <li> <tt>rowspan</tt> -- Specifies how many rows this cell spans. The
|
---|
266 | default is 1.
|
---|
267 | <li> <tt>align</tt> -- Alignment; possible values are <tt>left</tt>, <tt>right</tt>, and <tt>center</tt>. The default is <tt>left</tt>.
|
---|
268 | <li> <tt>valign</tt> -- Vertical alignment; possible values are <tt>top</tt>, <tt>middle</tt>, and <tt>bottom</tt>. The default is <tt>middle</tt>.
|
---|
269 | </ul>
|
---|
270 | </table></center>
|
---|
271 | <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>.
|
---|
272 |
|
---|
273 | <hr><h2>Member Function Documentation</h2>
|
---|
274 | <h3 class=fn><a name="QStyleSheet"></a>QStyleSheet::QStyleSheet ( <a href="qobject.html">QObject</a> * parent = 0, const char * name = 0 )
|
---|
275 | </h3>
|
---|
276 | Creates a style sheet called <em>name</em>, with parent <em>parent</em>. Like
|
---|
277 | any <a href="qobject.html">QObject</a> it will be deleted when its parent is destroyed (if
|
---|
278 | the child still exists).
|
---|
279 | <p> By default the style sheet has the tag definitions defined above.
|
---|
280 |
|
---|
281 | <h3 class=fn><a name="~QStyleSheet"></a>QStyleSheet::~QStyleSheet ()<tt> [virtual]</tt>
|
---|
282 | </h3>
|
---|
283 | Destroys the style sheet. All styles inserted into the style sheet
|
---|
284 | will be deleted.
|
---|
285 |
|
---|
286 | <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>
|
---|
287 | </h3> Auxiliary function. Converts the plain text string <em>plain</em> to a
|
---|
288 | rich text formatted paragraph while preserving most of its look.
|
---|
289 | <p> <em>mode</em> defines the whitespace mode. Possible values are <a href="qstylesheetitem.html#WhiteSpaceMode-enum">QStyleSheetItem::WhiteSpacePre</a> (no wrapping, all whitespaces
|
---|
290 | preserved) and <a href="qstylesheetitem.html#WhiteSpaceMode-enum">QStyleSheetItem::WhiteSpaceNormal</a> (wrapping,
|
---|
291 | simplified whitespaces).
|
---|
292 | <p> <p>See also <a href="#escape">escape</a>().
|
---|
293 |
|
---|
294 | <p>Examples: <a href="qaction-application-example.html#x1163">action/application.cpp</a>, <a href="simple-application-example.html#x1581">application/application.cpp</a>, and <a href="mdi-example.html#x2067">mdi/application.cpp</a>.
|
---|
295 | <h3 class=fn><a href="qstylesheet.html">QStyleSheet</a> * <a name="defaultSheet"></a>QStyleSheet::defaultSheet ()<tt> [static]</tt>
|
---|
296 | </h3>
|
---|
297 | Returns the application-wide default style sheet. This style sheet
|
---|
298 | is used by rich text rendering classes such as <a href="qsimplerichtext.html">QSimpleRichText</a>,
|
---|
299 | <a href="qwhatsthis.html">QWhatsThis</a> and <a href="qmessagebox.html">QMessageBox</a> to define the rendering style and
|
---|
300 | available tags within rich text documents. It also serves as the
|
---|
301 | initial style sheet for the more complex render widgets, <a href="qtextedit.html">QTextEdit</a>
|
---|
302 | and <a href="qtextbrowser.html">QTextBrowser</a>.
|
---|
303 | <p> <p>See also <a href="#setDefaultSheet">setDefaultSheet</a>().
|
---|
304 |
|
---|
305 | <h3 class=fn>void <a name="error"></a>QStyleSheet::error ( const <a href="qstring.html">QString</a> & msg ) const<tt> [virtual]</tt>
|
---|
306 | </h3>
|
---|
307 |
|
---|
308 | <p> This virtual function is called when an error occurs when
|
---|
309 | processing rich text. Reimplement it if you need to catch error
|
---|
310 | messages.
|
---|
311 | <p> Errors might occur if some rich text strings contain tags that are
|
---|
312 | not understood by the stylesheet, if some tags are nested
|
---|
313 | incorrectly, or if tags are not closed properly.
|
---|
314 | <p> <em>msg</em> is the error message.
|
---|
315 |
|
---|
316 | <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>
|
---|
317 | </h3>
|
---|
318 | Auxiliary function. Converts the plain text string <em>plain</em> to a
|
---|
319 | rich text formatted string with any HTML meta-characters escaped.
|
---|
320 | <p> <p>See also <a href="#convertFromPlainText">convertFromPlainText</a>().
|
---|
321 |
|
---|
322 | <h3 class=fn><a href="qstylesheetitem.html">QStyleSheetItem</a> * <a name="item"></a>QStyleSheet::item ( const <a href="qstring.html">QString</a> & name )
|
---|
323 | </h3>
|
---|
324 | Returns the style called <em>name</em> or 0 if there is no such style.
|
---|
325 |
|
---|
326 | <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
|
---|
327 | </h3>
|
---|
328 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
329 | <p> Returns the style called <em>name</em> or 0 if there is no such style
|
---|
330 | (const version)
|
---|
331 |
|
---|
332 | <h3 class=fn>bool <a name="mightBeRichText"></a>QStyleSheet::mightBeRichText ( const <a href="qstring.html">QString</a> & text )<tt> [static]</tt>
|
---|
333 | </h3>
|
---|
334 | Returns TRUE if the string <em>text</em> is likely to be rich text;
|
---|
335 | otherwise returns FALSE.
|
---|
336 | <p> This function uses a fast and therefore simple heuristic. It
|
---|
337 | mainly checks whether there is something that looks like a tag
|
---|
338 | before the first line break. Although the result may be correct
|
---|
339 | for common cases, there is no guarantee.
|
---|
340 |
|
---|
341 | <h3 class=fn>void <a name="scaleFont"></a>QStyleSheet::scaleFont ( <a href="qfont.html">QFont</a> & font, int logicalSize ) const<tt> [virtual]</tt>
|
---|
342 | </h3>
|
---|
343 | Scales the font <em>font</em> to the appropriate physical point size
|
---|
344 | corresponding to the logical font size <em>logicalSize</em>.
|
---|
345 | <p> When calling this function, <em>font</em> has a point size corresponding
|
---|
346 | to the logical font size 3.
|
---|
347 | <p> Logical font sizes range from 1 to 7, with 1 being the smallest.
|
---|
348 | <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>().
|
---|
349 |
|
---|
350 | <h3 class=fn>void <a name="setDefaultSheet"></a>QStyleSheet::setDefaultSheet ( <a href="qstylesheet.html">QStyleSheet</a> * sheet )<tt> [static]</tt>
|
---|
351 | </h3>
|
---|
352 | Sets the application-wide default style sheet to <em>sheet</em>,
|
---|
353 | deleting any style sheet previously set. The ownership is
|
---|
354 | transferred to QStyleSheet.
|
---|
355 | <p> <p>See also <a href="#defaultSheet">defaultSheet</a>().
|
---|
356 |
|
---|
357 | <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>
|
---|
358 | </h3>
|
---|
359 | <p><b>This function is under development and is subject to change.</b>
|
---|
360 | <p> Generates an internal object for the tag called <em>name</em>, given the
|
---|
361 | attributes <em>attr</em>, and using additional information provided by
|
---|
362 | the mime source factory <em>factory</em>.
|
---|
363 | <p> <em>context</em> is the optional context of the document, i.e. the path
|
---|
364 | to look for relative links. This becomes important if the text
|
---|
365 | contains relative references, for example within image tags.
|
---|
366 | <a href="qsimplerichtext.html">QSimpleRichText</a> always uses the default mime source factory (see
|
---|
367 | <a href="qmimesourcefactory.html#defaultFactory">QMimeSourceFactory::defaultFactory</a>()) to resolve these
|
---|
368 | references. The context will then be used to calculate the
|
---|
369 | absolute path. See <a href="qmimesourcefactory.html#makeAbsolute">QMimeSourceFactory::makeAbsolute</a>() for details.
|
---|
370 | <p> <em>emptyTag</em> and <em>doc</em> are for internal use only.
|
---|
371 | <p> This function should not be used in application code.
|
---|
372 |
|
---|
373 | <!-- eof -->
|
---|
374 | <hr><p>
|
---|
375 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
376 | Copyright © 1995-2007
|
---|
377 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
378 | <table width=100% cellspacing=0 border=0><tr>
|
---|
379 | <td>Copyright © 2007
|
---|
380 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
381 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
382 | </table></div></address></body>
|
---|
383 | </html>
|
---|