The Q3StyleSheetItem class provides an encapsulation of a set of text styles. More...
#include <Q3StyleSheetItem>
This class is part of the Qt 3 support library. It is provided to keep old source code working. We strongly advise against using it in new code. See Porting to Qt 4 for more information.
enum | DisplayMode { DisplayBlock, DisplayInline, DisplayListItem, DisplayNone } |
enum | ListStyle { ListDisc, ListCircle, ListSquare, ListDecimal, ListLowerAlpha, ListUpperAlpha } |
enum | Margin { MarginLeft, MarginRight, MarginTop, MarginBottom, ..., MarginUndefined } |
enum | VerticalAlignment { VAlignBaseline, VAlignSub, VAlignSuper } |
enum | WhiteSpaceMode { WhiteSpaceNormal, WhiteSpacePre, WhiteSpaceNoWrap } |
Q3StyleSheetItem ( Q3StyleSheet * parent, const QString & name ) | |
Q3StyleSheetItem ( const Q3StyleSheetItem & other ) | |
~Q3StyleSheetItem () | |
int | alignment () const |
bool | allowedInContext ( const Q3StyleSheetItem * s ) const |
QColor | color () const |
QString | contexts () const |
bool | definesFontItalic () const |
bool | definesFontStrikeOut () const |
bool | definesFontUnderline () const |
DisplayMode | displayMode () const |
QString | fontFamily () const |
bool | fontItalic () const |
int | fontSize () const |
bool | fontStrikeOut () const |
bool | fontUnderline () const |
int | fontWeight () const |
bool | isAnchor () const |
int | lineSpacing () const |
ListStyle | listStyle () const |
int | logicalFontSize () const |
int | logicalFontSizeStep () const |
int | margin ( Margin m ) const |
QString | name () const |
int | numberOfColumns () const |
bool | selfNesting () const |
void | setAlignment ( int f ) |
void | setAnchor ( bool anc ) |
void | setColor ( const QColor & c ) |
void | setContexts ( const QString & c ) |
void | setDisplayMode ( DisplayMode m ) |
void | setFontFamily ( const QString & fam ) |
void | setFontItalic ( bool italic ) |
void | setFontSize ( int s ) |
void | setFontStrikeOut ( bool strikeOut ) |
void | setFontUnderline ( bool underline ) |
void | setFontWeight ( int w ) |
void | setListStyle ( ListStyle s ) |
void | setLogicalFontSize ( int s ) |
void | setLogicalFontSizeStep ( int s ) |
void | setMargin ( Margin m, int v ) |
void | setNumberOfColumns ( int ncols ) |
void | setSelfNesting ( bool nesting ) |
void | setVerticalAlignment ( VerticalAlignment valign ) |
void | setWhiteSpaceMode ( WhiteSpaceMode m ) |
Q3StyleSheet * | styleSheet () |
const Q3StyleSheet * | styleSheet () const |
VerticalAlignment | verticalAlignment () const |
WhiteSpaceMode | whiteSpaceMode () const |
Q3StyleSheetItem & | operator= ( const Q3StyleSheetItem & other ) |
The Q3StyleSheetItem class provides an encapsulation of a set of text styles.
A style sheet item consists of a name and a set of attributes that specify 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.
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().
This enum type defines the way adjacent elements are displayed.
Constant | Value | Description |
---|---|---|
Q3StyleSheetItem::DisplayBlock | 0 | elements are displayed as a rectangular block (e.g. <p>...</p>). |
Q3StyleSheetItem::DisplayInline | 1 | elements are displayed in a horizontally flowing sequence (e.g. <em>...</em>). |
Q3StyleSheetItem::DisplayListItem | 2 | elements are displayed in a vertical sequence (e.g. <li>...</li>). |
Q3StyleSheetItem::DisplayNone | 3 | elements are not displayed at all. |
This enum type defines how the items in a list are prefixed when displayed.
Constant | Value | Description |
---|---|---|
Q3StyleSheetItem::ListDisc | 0 | a filled circle (i.e. a bullet) |
Q3StyleSheetItem::ListCircle | 1 | an unfilled circle |
Q3StyleSheetItem::ListSquare | 2 | a filled square |
Q3StyleSheetItem::ListDecimal | 3 | an integer in base 10: 1, 2, 3, ... |
Q3StyleSheetItem::ListLowerAlpha | 4 | a lowercase letter: a, b, c, ... |
Q3StyleSheetItem::ListUpperAlpha | 5 | an uppercase letter: A, B, C, ... |
Constant | Value | Description |
---|---|---|
Q3StyleSheetItem::MarginLeft | 0 | left margin |
Q3StyleSheetItem::MarginRight | 1 | right margin |
Q3StyleSheetItem::MarginTop | 2 | top margin |
Q3StyleSheetItem::MarginBottom | 3 | bottom margin |
Q3StyleSheetItem::MarginAll | 5 | all margins (left, right, top and bottom) |
Q3StyleSheetItem::MarginVertical | 6 | top and bottom margins |
Q3StyleSheetItem::MarginHorizontal | 7 | left and right margins |
Q3StyleSheetItem::MarginFirstLine | 4 | margin (indentation) of the first line of a paragarph (in addition to the MarginLeft of the paragraph) |
Q3StyleSheetItem::MarginUndefined | -1 |
This enum type defines the way elements are aligned vertically. This is only supported for text elements.
Constant | Value | Description |
---|---|---|
Q3StyleSheetItem::VAlignBaseline | 0 | align the baseline of the element (or the bottom, if the element doesn't have a baseline) with the baseline of the parent |
Q3StyleSheetItem::VAlignSub | 1 | subscript the element |
Q3StyleSheetItem::VAlignSuper | 2 | superscript the element |
This enum defines the ways in which Q3StyleSheet can treat whitespace.
Constant | Value | Description |
---|---|---|
Q3StyleSheetItem::WhiteSpaceNormal | 0 | any sequence of whitespace (including line-breaks) is equivalent to a single space. |
Q3StyleSheetItem::WhiteSpacePre | 1 | whitespace must be output exactly as given in the input. |
Q3StyleSheetItem::WhiteSpaceNoWrap | 2 | multiple spaces are collapsed as with WhiteSpaceNormal, but no automatic line-breaks occur. To break lines manually, use the <br> tag. |
Constructs a new style called name for the stylesheet parent.
All properties in Q3StyleSheetItem are initially in the "do not change" state, except display mode, which defaults to DisplayInline.
Copy constructor. Constructs a copy of other that is not bound to any style sheet.
Destroys the style. Note that Q3StyleSheetItem objects become owned by Q3StyleSheet when they are created.
Returns the alignment of this style. Possible values are Qt::AlignAuto, Qt::AlignLeft, Qt::AlignRight, Qt::AlignCenter or Qt::AlignJustify.
See also setAlignment() and Qt::Alignment.
Returns true if this style can be nested into an element of style s; otherwise returns false.
See also contexts() and setContexts().
Returns the text color of this style or an invalid color if no color has been set.
See also setColor() and QColor::isValid().
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.
See also setContexts().
Returns true if the style defines a font shape; otherwise returns false. A style does not define any shape until setFontItalic() is called.
See also setFontItalic() and fontItalic().
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.
See also setFontStrikeOut() and fontStrikeOut().
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.
See also setFontUnderline() and fontUnderline().
Returns the display mode of the style.
See also setDisplayMode().
Returns the style's font family setting. This is either a valid font family or an empty string if no family has been set.
See also setFontFamily(), QFont::family(), and QFont::setFamily().
Returns true if the style sets an italic font; otherwise returns false.
See also setFontItalic() and definesFontItalic().
Returns the font size setting of the style. This is either a valid point size or Q3StyleSheetItem::Undefined.
See also setFontSize(), QFont::pointSize(), and QFont::setPointSize().
Returns true if the style sets a strike out font; otherwise returns false.
See also setFontStrikeOut() and definesFontStrikeOut().
Returns true if the style sets an underlined font; otherwise returns false.
See also setFontUnderline() and definesFontUnderline().
Returns the font weight setting of the style. This is either a valid QFont::Weight or the value Q3StyleSheetItem::Undefined.
See also setFontWeight() and QFont.
Returns whether this style is an anchor.
See also setAnchor().
Returns the line spacing.
Returns the list style of the style.
See also setListStyle() and ListStyle.
Returns the logical font size setting of the style. This is either a valid size between 1 and 7 or Q3StyleSheetItem::Undefined.
See also setLogicalFontSize(), setLogicalFontSizeStep(), QFont::pointSize(), and QFont::setPointSize().
Returns the logical font size step of this style.
The default is 0. Tags such as big define +1; small defines -1.
See also setLogicalFontSizeStep().
Returns the width of margin m in pixels.
The margin, m, can be MarginLeft, MarginRight, MarginTop, MarginBottom, or MarginFirstLine
See also setMargin() and Margin.
Returns the name of the style item.
Returns the number of columns for this style.
See also setNumberOfColumns(), displayMode(), and setDisplayMode().
Returns true if this style has self-nesting enabled; otherwise returns false.
See also setSelfNesting().
Sets the alignment to f. This only makes sense for styles with a display mode of DisplayBlock. Possible values are Qt::AlignAuto, Qt::AlignLeft, Qt::AlignRight, Qt::AlignCenter or Qt::AlignJustify.
See also alignment(), displayMode(), and Qt::Alignment.
If anc 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.
See also isAnchor().
Sets the text color of this style to c.
See also color().
Sets a space-separated list of names of styles that may contain elements of this style. If c is empty, the style can be nested everywhere.
See also contexts().
Sets the display mode of the style to m.
See also displayMode().
Sets the font family setting of the style to fam.
See also fontFamily(), QFont::family(), and QFont::setFamily().
If italic is true sets italic for the style; otherwise sets upright.
See also fontItalic() and definesFontItalic().
Sets the font size setting of the style to s points.
See also fontSize(), QFont::pointSize(), and QFont::setPointSize().
If strikeOut is true, sets strike out for the style; otherwise sets no strike out.
See also fontStrikeOut() and definesFontStrikeOut().
If underline is true, sets underline for the style; otherwise sets no underline.
See also fontUnderline() and definesFontUnderline().
Sets the font weight setting of the style to w. Valid values are those defined by QFont::Weight.
See also QFont and fontWeight().
Sets the list style of the style to s.
This is used by nested elements that have a display mode of DisplayListItem.
See also listStyle(), DisplayMode, and ListStyle.
Sets the logical font size setting of the style to s. Valid logical sizes are 1 to 7.
See also logicalFontSize(), QFont::pointSize(), and QFont::setPointSize().
Sets the logical font size step of this style to s.
See also logicalFontSizeStep().
Sets the width of margin m to v pixels.
The margin, m, can be MarginLeft, MarginRight, MarginTop, MarginBottom, MarginFirstLine, MarginAll, MarginVertical or MarginHorizontal. The value v must be >= 0.
See also margin().
Sets the number of columns for this style to ncols. Elements in the style are divided into columns.
This makes sense only if the style uses a block display mode (see Q3StyleSheetItem::DisplayMode).
See also numberOfColumns().
Sets the self-nesting property for this style to nesting.
In order to support "dirty" HTML, paragraphs <p> and list items <li> are not self-nesting. This means that starting a new paragraph or list item automatically closes the previous one.
See also selfNesting().
Sets the vertical alignment to valign. Possible values are VAlignBaseline, VAlignSub or VAlignSuper.
The vertical alignment property is not inherited.
See also verticalAlignment().
Sets the whitespace mode to m.
See also whiteSpaceMode() and WhiteSpaceMode.
Returns the style sheet this item is in.
This is an overloaded function.
Returns the style sheet this item is in.
Returns the vertical alignment of the style. Possible values are VAlignBaseline, VAlignSub or VAlignSuper.
See also setVerticalAlignment().
Returns the whitespace mode.
See also setWhiteSpaceMode() and WhiteSpaceMode.
Assignment. Assings a copy of other that is not bound to any style sheet. Unbounds first from previous style sheet.
© 2008-2011 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners. Privacy Policy
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.