QStyleSheet

Section: Misc. Reference Manual Pages (3qt)
Updated: 2 February 2007
Index Return to Main Contents
 

NAME

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

SYNOPSIS

#include <qstylesheet.h>

Inherits QObject.

 

Public Members


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

virtual ~QStyleSheet ()

QStyleSheetItem * item ( const QString & name )

const QStyleSheetItem * item ( const QString & name ) const

virtual QTextCustomItem * tag ( const QString & name, const QMap<QString, QString> & attr, const QString & context, const QMimeSourceFactory & factory, bool emptyTag, QTextDocument * doc ) const

virtual void scaleFont ( QFont & font, int logicalSize ) const

virtual void error ( const QString & msg ) const
 

Static Public Members


QStyleSheet * defaultSheet ()

void setDefaultSheet ( QStyleSheet * sheet )

QString escape ( const QString & plain )

QString convertFromPlainText ( const QString & plain, QStyleSheetItem::WhiteSpaceMode mode = QStyleSheetItem::WhiteSpacePre )

bool mightBeRichText ( const QString & text )
 

DESCRIPTION

The QStyleSheet class is a collection of styles for rich text rendering and a generator of tags.

By creating QStyleSheetItem 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 QTextEdit or a QTextBrowser. However, QLabel, QWhatsThis and QMessageBox also support it, and other classes are likely to follow. With QSimpleRichText it is possible to use the rich text renderer for custom widgets as well.

The default QStyleSheet 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.

The structuring tags are <center>.nf
A top-level heading.
A sublevel heading.
A sub-sublevel heading.
Headings of lesser importance.
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