1QStyleSheet(3qt)                                              QStyleSheet(3qt)
2
3
4

NAME

6       QStyleSheet - Collection of styles for rich text rendering and a
7       generator of tags
8

SYNOPSIS

10       #include <qstylesheet.h>
11
12       Inherits QObject.
13
14   Public Members
15       QStyleSheet ( QObject * parent = 0, const char * name = 0 )
16       virtual ~QStyleSheet ()
17       QStyleSheetItem * item ( const QString & name )
18       const QStyleSheetItem * item ( const QString & name ) const
19       virtual QTextCustomItem * tag ( const QString & name, const
20           QMap<QString, QString> & attr, const QString & context, const
21           QMimeSourceFactory & factory, bool emptyTag, QTextDocument * doc )
22           const
23       virtual void scaleFont ( QFont & font, int logicalSize ) const
24       virtual void error ( const QString & msg ) const
25
26   Static Public Members
27       QStyleSheet * defaultSheet ()
28       void setDefaultSheet ( QStyleSheet * sheet )
29       QString escape ( const QString & plain )
30       QString convertFromPlainText ( const QString & plain,
31           QStyleSheetItem::WhiteSpaceMode mode =
32           QStyleSheetItem::WhiteSpacePre )
33       bool mightBeRichText ( const QString & text )
34

DESCRIPTION

36       The QStyleSheet class is a collection of styles for rich text rendering
37       and a generator of tags.
38
39       By creating QStyleSheetItem objects for a style sheet you build a
40       definition of a set of tags. This definition will be used by the
41       internal rich text rendering system to parse and display text documents
42       to which the style sheet applies. Rich text is normally visualized in a
43       QTextEdit or a QTextBrowser. However, QLabel, QWhatsThis and
44       QMessageBox also support it, and other classes are likely to follow.
45       With QSimpleRichText it is possible to use the rich text renderer for
46       custom widgets as well.
47
48       The default QStyleSheet object has the following style bindings, sorted
49       by structuring bindings, anchors, character style bindings (i.e. inline
50       styles), special elements such as horizontal lines or images, and other
51       tags. In addition, rich text supports simple HTML tables.
52
53       The structuring tags are <center>.nf
54
55       </center>
56
57       Anchors and links are done with a single tag: <center>.nf
58
59       </center>
60
61       The default character style bindings are <center>.nf
62
63       </center>
64
65       Special elements are: <center>.nf
66
67       Special tags
68       ───────────────────────────────────────────
69
70       given in the source attribute, for example
71
72
73
74       </center>
75
76       In addition, rich text supports simple HTML tables. A table consists of
77       one or more rows each of which contains one or more cells. Cells are
78       either data cells or header cells, depending on their content. Cells
79       which span rows and columns are supported.
80
81       <center>.nf
82
83       </center>
84
85       See also Graphics Classes, Help System, and Text Related Classes.
86

MEMBER FUNCTION DOCUMENTATION

QStyleSheet::QStyleSheet ( QObject * parent = 0, const char * name = 0 )

89       Creates a style sheet called name, with parent parent. Like any QObject
90       it will be deleted when its parent is destroyed (if the child still
91       exists).
92
93       By default the style sheet has the tag definitions defined above.
94

QStyleSheet::~QStyleSheet () [virtual]

96       Destroys the style sheet. All styles inserted into the style sheet will
97       be deleted.
98

QString QStyleSheet::convertFromPlainText ( const QString & plain,

100       QStyleSheetItem::WhiteSpaceMode mode = QStyleSheetItem::WhiteSpacePre )
101       [static]
102       Auxiliary function. Converts the plain text string plain to a rich text
103       formatted paragraph while preserving most of its look.
104
105       mode defines the whitespace mode. Possible values are
106       QStyleSheetItem::WhiteSpacePre (no wrapping, all whitespaces preserved)
107       and QStyleSheetItem::WhiteSpaceNormal (wrapping, simplified
108       whitespaces).
109
110       See also escape().
111
112       Examples:
113

QStyleSheet * QStyleSheet::defaultSheet () [static]

115       Returns the application-wide default style sheet. This style sheet is
116       used by rich text rendering classes such as QSimpleRichText, QWhatsThis
117       and QMessageBox to define the rendering style and available tags within
118       rich text documents. It also serves as the initial style sheet for the
119       more complex render widgets, QTextEdit and QTextBrowser.
120
121       See also setDefaultSheet().
122

void QStyleSheet::error ( const QString & msg ) const [virtual]

124       This virtual function is called when an error occurs when processing
125       rich text. Reimplement it if you need to catch error messages.
126
127       Errors might occur if some rich text strings contain tags that are not
128       understood by the stylesheet, if some tags are nested incorrectly, or
129       if tags are not closed properly.
130
131       msg is the error message.
132

QString QStyleSheet::escape ( const QString & plain ) [static]

134       Auxiliary function. Converts the plain text string plain to a rich text
135       formatted string with any HTML meta-characters escaped.
136
137       See also convertFromPlainText().
138

QStyleSheetItem * QStyleSheet::item ( const QString & name )

140       Returns the style called name or 0 if there is no such style.
141

const QStyleSheetItem * QStyleSheet::item ( const QString & name ) const

143       This is an overloaded member function, provided for convenience. It
144       behaves essentially like the above function.
145
146       Returns the style called name or 0 if there is no such style (const
147       version)
148

bool QStyleSheet::mightBeRichText ( const QString & text ) [static]

150       Returns TRUE if the string text is likely to be rich text; otherwise
151       returns FALSE.
152
153       This function uses a fast and therefore simple heuristic. It mainly
154       checks whether there is something that looks like a tag before the
155       first line break. Although the result may be correct for common cases,
156       there is no guarantee.
157

void QStyleSheet::scaleFont ( QFont & font, int logicalSize ) const [virtual]

159       Scales the font font to the appropriate physical point size
160       corresponding to the logical font size logicalSize.
161
162       When calling this function, font has a point size corresponding to the
163       logical font size 3.
164
165       Logical font sizes range from 1 to 7, with 1 being the smallest.
166
167       See also QStyleSheetItem::logicalFontSize(),
168       QStyleSheetItem::logicalFontSizeStep(), and QFont::setPointSize().
169

void QStyleSheet::setDefaultSheet ( QStyleSheet * sheet ) [static]

171       Sets the application-wide default style sheet to sheet, deleting any
172       style sheet previously set. The ownership is transferred to
173       QStyleSheet.
174
175       See also defaultSheet().
176

QTextCustomItem * QStyleSheet::tag ( const QString & name, const QMap<QString,

178       QString> & attr, const QString & context, const QMimeSourceFactory &
179       factory, bool emptyTag, QTextDocument * doc ) const [virtual]
180       This function is under development and is subject to change.
181
182       Generates an internal object for the tag called name, given the
183       attributes attr, and using additional information provided by the mime
184       source factory factory.
185
186       context is the optional context of the document, i.e. the path to look
187       for relative links. This becomes important if the text contains
188       relative references, for example within image tags. QSimpleRichText
189       always uses the default mime source factory (see
190       QMimeSourceFactory::defaultFactory()) to resolve these references. The
191       context will then be used to calculate the absolute path. See
192       QMimeSourceFactory::makeAbsolute() for details.
193
194       emptyTag and doc are for internal use only.
195
196       This function should not be used in application code.
197
198

SEE ALSO

200       http://doc.trolltech.com/qstylesheet.html
201       http://www.trolltech.com/faq/tech.html
202
204       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
205       license file included in the distribution for a complete license
206       statement.
207

AUTHOR

209       Generated automatically from the source code.
210

BUGS

212       If you find a bug in Qt, please report it as described in
213       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
214       help you. Thank you.
215
216       The definitive Qt documentation is provided in HTML format; it is
217       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
218       web browser. This man page is provided as a convenience for those users
219       who prefer man pages, although this format is not officially supported
220       by Trolltech.
221
222       If you find errors in this manual page, please report them to qt-
223       bugs@trolltech.com.  Please include the name of the manual page
224       (qstylesheet.3qt) and the Qt version (3.3.8).
225
226
227
228Trolltech AS                    2 February 2007               QStyleSheet(3qt)
Impressum