By creating TQStyleSheetItem objects for a style sheet you build a definition of a set of tags. This definition will be used by the internal rich text rendering system to parse and display text documents to which the style sheet applies. Rich text is normally visualized in a TQTextEdit or a TQTextBrowser. However, TQLabel, TQWhatsThis and QMessageBox also support it, and other classes are likely to follow. With TQSimpleRichText it is possible to use the rich text renderer for custom widgets as well.
The default TQStyleSheet object has the following style bindings, sorted by structuring bindings, anchors, character style bindings (i.e. inline styles), special elements such as horizontal lines or images, and other tags. In addition, rich text supports simple HTML tables.
A left-aligned paragraph. Adjust the alignment with the
A centered paragraph.
An indented paragraph that is useful for quotes.
An unordered list. You can also pass a type argument to
define the bullet style. The default is
An ordered list. You can also pass a type argument to
define the enumeration label style. The default is
A list item. This tag can be used only within the context
of
A list of definitions, consisting of terms and descriptions.
A term in a list of definitions. This tag can be used only
in the context of
A description in a list of definitions. This tag can be
used only in the context of
For larger chunks of code. Whitespaces in the contents are
preserved. For small bits of code use the inline-style
.TE
.fi
</center>
.PP
Anchors and links are done with a single tag: <center>.nf
.TS
l - l. Anchor tags Notes An anchor or link.
.TP
A link is created by using an
.TE
.fi
</center>
.PP
The default character style bindings are <center>.nf
.TS
l - l. Style tags Notes Emphasized. By default this is the same as Strong. By default this is the same as Italic font style. Bold font style. Underlined font style. Strike out font style. A larger font size. A smaller font size. Subscripted text Superscripted text Indicates code. By default this is the same as Typewriter font style. Customizes the font size, family and text color. The tag understands the following attributes:
.TP
.TE
.fi
</center>
.PP
Special elements are: <center>.nf
.TS
l
-
l.
Special tags Notes
An image. The image name for the mime source factory is
given in the source attribute, for example
A horizontal line.
A line break.
.TE
.fi
</center>
.PP
In addition, rich text supports simple HTML tables. A table consists of one or more rows each of which contains one or more cells. Cells are either data cells or header cells, depending on their content. Cells which span rows and columns are supported.
.PP
<center>.nf
.TS
l - l. Table tags Notes A table. Tables support the following attributes:
.TP
A table row. This is only valid within a A table header cell. Similar to A table data cell. This is only valid within a
.TE
.fi
</center>
.PP
See also Graphics Classes, Help System, and Text Related Classes.
Creates a style sheet called \fIname\fR, with parent \fIparent\fR. Like any TQObject it will be deleted when its parent is destroyed (if the child still exists).
\fImode\fR defines the whitespace mode. Possible values are TQStyleSheetItem::WhiteSpacePre (no wrapping, all whitespaces preserved) and TQStyleSheetItem::WhiteSpaceNormal (wrapping, simplified whitespaces).
Returns the application-wide default style sheet. This style sheet is used by rich text rendering classes such as TQSimpleRichText, TQWhatsThis and QMessageBox to define the rendering style and available tags within rich text documents. It also serves as the initial style sheet for the more complex render widgets, TQTextEdit and TQTextBrowser.
This virtual function is called when an error occurs when processing rich text. Reimplement it if you need to catch error messages.
.PP
Errors might occur if some rich text strings contain tags that are not understood by the stylesheet, if some tags are nested incorrectly, or if tags are not closed properly.
Returns TRUE if the string \fItext\fR is likely to be rich text; otherwise returns FALSE.
.PP
This function uses a fast and therefore simple heuristic. It mainly checks whether there is something that looks like a tag before the first line break. Although the result may be correct for common cases, there is no guarantee.
\fBThis function is under development and is subject to change.\fR
.PP
Generates an internal object for the tag called \fIname\fR, given the attributes \fIattr\fR, and using additional information provided by the mime source factory \fIfactory\fR.
\fIcontext\fR is the optional context of the document, i.e. the path to look for relative links. This becomes important if the text contains relative references, for example within image tags. TQSimpleRichText always uses the default mime source factory (see TQMimeSourceFactory::defaultFactory()) to resolve these references. The context will then be used to calculate the absolute path. See TQMimeSourceFactory::makeAbsolute() for details.