You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tqt3/doc/man/man3/tqstylesheetitem.3qt

485 lines
19 KiB

'\" t
.TH QStyleSheetItem 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QStyleSheetItem \- Encapsulation of a set of text styles
.SH SYNOPSIS
\fC#include <ntqstylesheet.h>\fR
.PP
Inherits Qt.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQStyleSheetItem\fR ( QStyleSheet * parent, const QString & name )"
.br
.ti -1c
.BI "\fBQStyleSheetItem\fR ( const QStyleSheetItem & other )"
.br
.ti -1c
.BI "\fB~QStyleSheetItem\fR ()"
.br
.ti -1c
.BI "QStyleSheetItem & \fBoperator=\fR ( const QStyleSheetItem & other )"
.br
.ti -1c
.BI "QString \fBname\fR () const"
.br
.ti -1c
.BI "QStyleSheet * \fBstyleSheet\fR ()"
.br
.ti -1c
.BI "const QStyleSheet * \fBstyleSheet\fR () const"
.br
.ti -1c
.BI "enum \fBDisplayMode\fR { DisplayBlock, DisplayInline, DisplayListItem, DisplayNone }"
.br
.ti -1c
.BI "DisplayMode \fBdisplayMode\fR () const"
.br
.ti -1c
.BI "void \fBsetDisplayMode\fR ( DisplayMode m )"
.br
.ti -1c
.BI "int \fBalignment\fR () const"
.br
.ti -1c
.BI "void \fBsetAlignment\fR ( int f )"
.br
.ti -1c
.BI "enum \fBVerticalAlignment\fR { VAlignBaseline, VAlignSub, VAlignSuper }"
.br
.ti -1c
.BI "VerticalAlignment \fBverticalAlignment\fR () const"
.br
.ti -1c
.BI "void \fBsetVerticalAlignment\fR ( VerticalAlignment valign )"
.br
.ti -1c
.BI "int \fBfontWeight\fR () const"
.br
.ti -1c
.BI "void \fBsetFontWeight\fR ( int w )"
.br
.ti -1c
.BI "int \fBlogicalFontSize\fR () const"
.br
.ti -1c
.BI "void \fBsetLogicalFontSize\fR ( int s )"
.br
.ti -1c
.BI "int \fBlogicalFontSizeStep\fR () const"
.br
.ti -1c
.BI "void \fBsetLogicalFontSizeStep\fR ( int s )"
.br
.ti -1c
.BI "int \fBfontSize\fR () const"
.br
.ti -1c
.BI "void \fBsetFontSize\fR ( int s )"
.br
.ti -1c
.BI "QString \fBfontFamily\fR () const"
.br
.ti -1c
.BI "void \fBsetFontFamily\fR ( const QString & fam )"
.br
.ti -1c
.BI "int numberOfColumns () const \fI(obsolete)\fR"
.br
.ti -1c
.BI "void setNumberOfColumns ( int ncols ) \fI(obsolete)\fR"
.br
.ti -1c
.BI "QColor \fBcolor\fR () const"
.br
.ti -1c
.BI "void \fBsetColor\fR ( const QColor & c )"
.br
.ti -1c
.BI "bool \fBfontItalic\fR () const"
.br
.ti -1c
.BI "void \fBsetFontItalic\fR ( bool italic )"
.br
.ti -1c
.BI "bool \fBdefinesFontItalic\fR () const"
.br
.ti -1c
.BI "bool \fBfontUnderline\fR () const"
.br
.ti -1c
.BI "void \fBsetFontUnderline\fR ( bool underline )"
.br
.ti -1c
.BI "bool \fBdefinesFontUnderline\fR () const"
.br
.ti -1c
.BI "bool \fBfontStrikeOut\fR () const"
.br
.ti -1c
.BI "void \fBsetFontStrikeOut\fR ( bool strikeOut )"
.br
.ti -1c
.BI "bool \fBdefinesFontStrikeOut\fR () const"
.br
.ti -1c
.BI "bool \fBisAnchor\fR () const"
.br
.ti -1c
.BI "void \fBsetAnchor\fR ( bool anc )"
.br
.ti -1c
.BI "enum \fBWhiteSpaceMode\fR { WhiteSpaceNormal, WhiteSpacePre, WhiteSpaceNoWrap }"
.br
.ti -1c
.BI "WhiteSpaceMode \fBwhiteSpaceMode\fR () const"
.br
.ti -1c
.BI "void \fBsetWhiteSpaceMode\fR ( WhiteSpaceMode m )"
.br
.ti -1c
.BI "enum \fBMargin\fR { MarginLeft, MarginRight, MarginTop, MarginBottom, MarginFirstLine, MarginAll, MarginVertical, MarginHorizontal }"
.br
.ti -1c
.BI "int \fBmargin\fR ( Margin m ) const"
.br
.ti -1c
.BI "void \fBsetMargin\fR ( Margin m, int v )"
.br
.ti -1c
.BI "enum \fBListStyle\fR { ListDisc, ListCircle, ListSquare, ListDecimal, ListLowerAlpha, ListUpperAlpha }"
.br
.ti -1c
.BI "ListStyle \fBlistStyle\fR () const"
.br
.ti -1c
.BI "void \fBsetListStyle\fR ( ListStyle s )"
.br
.ti -1c
.BI "QString \fBcontexts\fR () const"
.br
.ti -1c
.BI "void \fBsetContexts\fR ( const QString & c )"
.br
.ti -1c
.BI "bool \fBallowedInContext\fR ( const QStyleSheetItem * s ) const"
.br
.ti -1c
.BI "bool \fBselfNesting\fR () const"
.br
.ti -1c
.BI "void \fBsetSelfNesting\fR ( bool nesting )"
.br
.ti -1c
.BI "int lineSpacing () const \fI(obsolete)\fR"
.br
.in -1c
.SH DESCRIPTION
The QStyleSheetItem class provides an encapsulation of a set of text styles.
.PP
A style sheet item consists of a name and a set of attributes that specifiy its font, color, etc. When used in a style sheet (see styleSheet()), items define the name() of a rich text tag and the display property changes associated with it.
.PP
The display mode attribute indicates whether the item is a block, an inline element or a list element; see setDisplayMode(). The treatment of whitespace is controlled by the white space mode; see setWhiteSpaceMode(). An item's margins are set with setMargin(), In the case of list items, the list style is set with setListStyle(). An item may be a hypertext link anchor; see setAnchor(). Other attributes are set with setAlignment(), setVerticalAlignment(), setFontFamily(), setFontSize(), setFontWeight(), setFontItalic(), setFontUnderline(), setFontStrikeOut and setColor().
.PP
See also Text Related Classes.
.SS "Member Type Documentation"
.SH "QStyleSheetItem::DisplayMode"
This enum type defines the way adjacent elements are displayed.
.TP
\fCQStyleSheetItem::DisplayBlock\fR - elements are displayed as a rectangular block (e.g. \fC<p>...</p>\fR).
.TP
\fCQStyleSheetItem::DisplayInline\fR - elements are displayed in a horizontally flowing sequence (e.g. \fC<em>...</em>\fR).
.TP
\fCQStyleSheetItem::DisplayListItem\fR - elements are displayed in a vertical sequence (e.g. \fC<li>...</li>\fR).
.TP
\fCQStyleSheetItem::DisplayNone\fR - elements are not displayed at all.
.SH "QStyleSheetItem::ListStyle"
This enum type defines how the items in a list are prefixed when displayed.
.TP
\fCQStyleSheetItem::ListDisc\fR - a filled circle (i.e. a bullet)
.TP
\fCQStyleSheetItem::ListCircle\fR - an unfilled circle
.TP
\fCQStyleSheetItem::ListSquare\fR - a filled square
.TP
\fCQStyleSheetItem::ListDecimal\fR - an integer in base 10: \fI1\fR, \fI2\fR, \fI3\fR, ...
.TP
\fCQStyleSheetItem::ListLowerAlpha\fR - a lowercase letter: \fIa\fR, \fIb\fR, \fIc\fR, ...
.TP
\fCQStyleSheetItem::ListUpperAlpha\fR - an uppercase letter: \fIA\fR, \fIB\fR, \fIC\fR, ...
.SH "QStyleSheetItem::Margin"
.TP
\fCQStyleSheetItem::MarginLeft\fR - left margin
.TP
\fCQStyleSheetItem::MarginRight\fR - right margin
.TP
\fCQStyleSheetItem::MarginTop\fR - top margin
.TP
\fCQStyleSheetItem::MarginBottom\fR - bottom margin
.TP
\fCQStyleSheetItem::MarginAll\fR - all margins (left, right, top and bottom)
.TP
\fCQStyleSheetItem::MarginVertical\fR - top and bottom margins
.TP
\fCQStyleSheetItem::MarginHorizontal\fR - left and right margins
.TP
\fCQStyleSheetItem::MarginFirstLine\fR - margin (indentation) of the first line of a paragarph (in addition to the MarginLeft of the paragraph)
.SH "QStyleSheetItem::VerticalAlignment"
This enum type defines the way elements are aligned vertically. This is only supported for text elements.
.TP
\fCQStyleSheetItem::VAlignBaseline\fR - align the baseline of the element (or the bottom, if the element doesn't have a baseline) with the baseline of the parent
.TP
\fCQStyleSheetItem::VAlignSub\fR - subscript the element
.TP
\fCQStyleSheetItem::VAlignSuper\fR - superscript the element
.SH "QStyleSheetItem::WhiteSpaceMode"
This enum defines the ways in which QStyleSheet can treat whitespace.
.TP
\fCQStyleSheetItem::WhiteSpaceNormal\fR - any sequence of whitespace (including line-breaks) is equivalent to a single space.
.TP
\fCQStyleSheetItem::WhiteSpacePre\fR - whitespace must be output exactly as given in the input.
.TP
\fCQStyleSheetItem::WhiteSpaceNoWrap\fR - multiple spaces are collapsed as with WhiteSpaceNormal, but no automatic line-breaks occur. To break lines manually, use the \fC<br>\fR tag.
.PP
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QStyleSheetItem::QStyleSheetItem ( QStyleSheet * parent, const QString & name )"
Constructs a new style called \fIname\fR for the stylesheet \fIparent\fR.
.PP
All properties in QStyleSheetItem are initially in the "do not change" state, except display mode, which defaults to DisplayInline.
.SH "QStyleSheetItem::QStyleSheetItem ( const QStyleSheetItem & other )"
Copy constructor. Constructs a copy of \fIother\fR that is not bound to any style sheet.
.SH "QStyleSheetItem::~QStyleSheetItem ()"
Destroys the style. Note that QStyleSheetItem objects become owned by QStyleSheet when they are created.
.SH "int QStyleSheetItem::alignment () const"
Returns the alignment of this style. Possible values are AlignAuto, AlignLeft, AlignRight, AlignCenter or AlignJustify.
.PP
See also setAlignment() and Qt::AlignmentFlags.
.SH "bool QStyleSheetItem::allowedInContext ( const QStyleSheetItem * s ) const"
Returns TRUE if this style can be nested into an element of style \fIs\fR; otherwise returns FALSE.
.PP
See also contexts() and setContexts().
.SH "QColor QStyleSheetItem::color () const"
Returns the text color of this style or an invalid color if no color has been set.
.PP
See also setColor() and QColor::isValid().
.SH "QString QStyleSheetItem::contexts () const"
Returns a space-separated list of names of styles that may contain elements of this style. If nothing has been set, contexts() returns an empty string, which indicates that this style can be nested everywhere.
.PP
See also setContexts().
.SH "bool QStyleSheetItem::definesFontItalic () const"
Returns TRUE if the style defines a font shape; otherwise returns FALSE. A style does not define any shape until setFontItalic() is called.
.PP
See also setFontItalic() and fontItalic().
.SH "bool QStyleSheetItem::definesFontStrikeOut () const"
Returns TRUE if the style defines a setting for the strikeOut property of the font; otherwise returns FALSE. A style does not define this until setFontStrikeOut() is called.
.PP
See also setFontStrikeOut() and fontStrikeOut().
.SH "bool QStyleSheetItem::definesFontUnderline () const"
Returns TRUE if the style defines a setting for the underline property of the font; otherwise returns FALSE. A style does not define this until setFontUnderline() is called.
.PP
See also setFontUnderline() and fontUnderline().
.SH "DisplayMode QStyleSheetItem::displayMode () const"
Returns the display mode of the style.
.PP
See also setDisplayMode().
.SH "QString QStyleSheetItem::fontFamily () const"
Returns the font family setting of the style. This is either a valid font family or QString::null if no family has been set.
.PP
See also setFontFamily(), QFont::family(), and QFont::setFamily().
.SH "bool QStyleSheetItem::fontItalic () const"
Returns TRUE if the style sets an italic font; otherwise returns FALSE.
.PP
See also setFontItalic() and definesFontItalic().
.SH "int QStyleSheetItem::fontSize () const"
Returns the font size setting of the style. This is either a valid point size or QStyleSheetItem::Undefined.
.PP
See also setFontSize(), QFont::pointSize(), and QFont::setPointSize().
.SH "bool QStyleSheetItem::fontStrikeOut () const"
Returns TRUE if the style sets a strike out font; otherwise returns FALSE.
.PP
See also setFontStrikeOut() and definesFontStrikeOut().
.SH "bool QStyleSheetItem::fontUnderline () const"
Returns TRUE if the style sets an underlined font; otherwise returns FALSE.
.PP
See also setFontUnderline() and definesFontUnderline().
.SH "int QStyleSheetItem::fontWeight () const"
Returns the font weight setting of the style. This is either a valid QFont::Weight or the value QStyleSheetItem::Undefined.
.PP
See also setFontWeight() and QFont.
.SH "bool QStyleSheetItem::isAnchor () const"
Returns whether this style is an anchor.
.PP
See also setAnchor().
.SH "int QStyleSheetItem::lineSpacing () const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Returns the linespacing
.SH "ListStyle QStyleSheetItem::listStyle () const"
Returns the list style of the style.
.PP
See also setListStyle() and ListStyle.
.SH "int QStyleSheetItem::logicalFontSize () const"
Returns the logical font size setting of the style. This is either a valid size between 1 and 7 or QStyleSheetItem::Undefined.
.PP
See also setLogicalFontSize(), setLogicalFontSizeStep(), QFont::pointSize(), and QFont::setPointSize().
.SH "int QStyleSheetItem::logicalFontSizeStep () const"
Returns the logical font size step of this style.
.PP
The default is 0. Tags such as \fCbig\fR define \fC+1\fR; \fCsmall\fR defines \fC-1\fR.
.PP
See also setLogicalFontSizeStep().
.SH "int QStyleSheetItem::margin ( Margin m ) const"
Returns the width of margin \fIm\fR in pixels.
.PP
The margin, \fIm\fR, can be MarginLeft, MarginRight, MarginTop, MarginBottom, or MarginFirstLine.
.PP
See also setMargin() and Margin.
.SH "QString QStyleSheetItem::name () const"
Returns the name of the style item.
.SH "int QStyleSheetItem::numberOfColumns () const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Returns the number of columns for this style.
.PP
See also setNumberOfColumns(), displayMode(), and setDisplayMode().
.SH "QStyleSheetItem & QStyleSheetItem::operator= ( const QStyleSheetItem & other )"
Assignment. Assings a copy of \fIother\fR that is not bound to any style sheet. Unbounds first from previous style sheet.
.SH "bool QStyleSheetItem::selfNesting () const"
Returns TRUE if this style has self-nesting enabled; otherwise returns FALSE.
.PP
See also setSelfNesting().
.SH "void QStyleSheetItem::setAlignment ( int f )"
Sets the alignment to \fIf\fR. This only makes sense for styles with a display mode of DisplayBlock. Possible values are AlignAuto, AlignLeft, AlignRight, AlignCenter or AlignJustify.
.PP
See also alignment(), displayMode(), and Qt::AlignmentFlags.
.SH "void QStyleSheetItem::setAnchor ( bool anc )"
If \fIanc\fR is TRUE, sets this style to be an anchor (hypertext link); otherwise sets it to not be an anchor. Elements in this style link to other documents or anchors.
.PP
See also isAnchor().
.SH "void QStyleSheetItem::setColor ( const QColor & c )"
Sets the text color of this style to \fIc\fR.
.PP
See also color().
.SH "void QStyleSheetItem::setContexts ( const QString & c )"
Sets a space-separated list of names of styles that may contain elements of this style. If \fIc\fR is empty, the style can be nested everywhere.
.PP
See also contexts().
.SH "void QStyleSheetItem::setDisplayMode ( DisplayMode m )"
Sets the display mode of the style to \fIm\fR.
.PP
See also displayMode().
.SH "void QStyleSheetItem::setFontFamily ( const QString & fam )"
Sets the font family setting of the style to \fIfam\fR.
.PP
See also fontFamily(), QFont::family(), and QFont::setFamily().
.SH "void QStyleSheetItem::setFontItalic ( bool italic )"
If \fIitalic\fR is TRUE sets italic for the style; otherwise sets upright.
.PP
See also fontItalic() and definesFontItalic().
.SH "void QStyleSheetItem::setFontSize ( int s )"
Sets the font size setting of the style to \fIs\fR points.
.PP
See also fontSize(), QFont::pointSize(), and QFont::setPointSize().
.SH "void QStyleSheetItem::setFontStrikeOut ( bool strikeOut )"
If \fIstrikeOut\fR is TRUE, sets strike out for the style; otherwise sets no strike out.
.PP
See also fontStrikeOut() and definesFontStrikeOut().
.SH "void QStyleSheetItem::setFontUnderline ( bool underline )"
If \fIunderline\fR is TRUE, sets underline for the style; otherwise sets no underline.
.PP
See also fontUnderline() and definesFontUnderline().
.SH "void QStyleSheetItem::setFontWeight ( int w )"
Sets the font weight setting of the style to \fIw\fR. Valid values are those defined by QFont::Weight.
.PP
See also QFont and fontWeight().
.SH "void QStyleSheetItem::setListStyle ( ListStyle s )"
Sets the list style of the style to \fIs\fR.
.PP
This is used by nested elements that have a display mode of DisplayListItem.
.PP
See also listStyle(), DisplayMode, and ListStyle.
.SH "void QStyleSheetItem::setLogicalFontSize ( int s )"
Sets the logical font size setting of the style to \fIs\fR. Valid logical sizes are 1 to 7.
.PP
See also logicalFontSize(), QFont::pointSize(), and QFont::setPointSize().
.SH "void QStyleSheetItem::setLogicalFontSizeStep ( int s )"
Sets the logical font size step of this style to \fIs\fR.
.PP
See also logicalFontSizeStep().
.SH "void QStyleSheetItem::setMargin ( Margin m, int v )"
Sets the width of margin \fIm\fR to \fIv\fR pixels.
.PP
The margin, \fIm\fR, can be MarginLeft, MarginRight, MarginTop, MarginBottom, MarginFirstLine, MarginAll, MarginVertical or MarginHorizontal. The value \fIv\fR must be >= 0.
.PP
See also margin().
.SH "void QStyleSheetItem::setNumberOfColumns ( int ncols )"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Sets the number of columns for this style. Elements in the style are divided into columns.
.PP
This makes sense only if the style uses a block display mode (see QStyleSheetItem::DisplayMode).
.PP
See also numberOfColumns().
.SH "void QStyleSheetItem::setSelfNesting ( bool nesting )"
Sets the self-nesting property for this style to \fInesting\fR.
.PP
In order to support "dirty" HTML, paragraphs \fC<p>\fR and list items \fC<li>\fR are not self-nesting. This means that starting a new paragraph or list item automatically closes the previous one.
.PP
See also selfNesting().
.SH "void QStyleSheetItem::setVerticalAlignment ( VerticalAlignment valign )"
Sets the vertical alignment to \fIvalign\fR. Possible values are VAlignBaseline, VAlignSub or VAlignSuper.
.PP
The vertical alignment property is not inherited.
.PP
See also verticalAlignment().
.SH "void QStyleSheetItem::setWhiteSpaceMode ( WhiteSpaceMode m )"
Sets the whitespace mode to \fIm\fR.
.PP
See also WhiteSpaceMode.
.SH "QStyleSheet * QStyleSheetItem::styleSheet ()"
Returns the style sheet this item is in.
.SH "const QStyleSheet * QStyleSheetItem::styleSheet () const"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns the style sheet this item is in.
.SH "VerticalAlignment QStyleSheetItem::verticalAlignment () const"
Returns the vertical alignment of the style. Possible values are VAlignBaseline, VAlignSub or VAlignSuper.
.PP
See also setVerticalAlignment().
.SH "WhiteSpaceMode QStyleSheetItem::whiteSpaceMode () const"
Returns the whitespace mode.
.PP
See also setWhiteSpaceMode() and WhiteSpaceMode.
.SH "SEE ALSO"
.BR http://doc.trolltech.com/qstylesheetitem.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive Qt documentation is provided in HTML format; it is
located at $QTDIR/doc/html and can be read using Qt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech.
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (tqstylesheetitem.3qt) and the Qt
version (3.3.8).