The Q3StyleSheetItem class provides an encapsulation of a set of text styles. 更多...
| 头: | #include <Q3StyleSheetItem> |
| 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 样式表 (见 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 ;见 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.
| 常量 | 值 | 描述 |
|---|---|---|
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.
| 常量 | 值 | 描述 |
|---|---|---|
Q3StyleSheetItem::ListDisc
|
0
|
a filled circle (i.e. a bullet) |
Q3StyleSheetItem::ListCircle
|
1
|
an unfilled circle |
Q3StyleSheetItem::ListSquare
|
2
|
填充正方形 |
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 , ... |
| 常量 | 值 | 描述 |
|---|---|---|
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.
| 常量 | 值 | 描述 |
|---|---|---|
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.
| 常量 | 值 | 描述 |
|---|---|---|
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>
标签。
|
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
,其默认为
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 .
另请参阅 setAlignment () 和 Qt::Alignment .
Returns true if this style can be nested into an element of style s ;否则返回 false。
另请参阅 contexts () 和 setContexts ().
Returns the text color of this style or an invalid color if no color has been set.
另请参阅 setColor () 和 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.
另请参阅 setContexts ().
Returns true if the style defines a font shape; otherwise returns false. A style does not define any shape until setFontItalic () 被调用。
另请参阅 setFontItalic () 和 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 () 被调用。
另请参阅 setFontStrikeOut () 和 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 () 被调用。
另请参阅 setFontUnderline () 和 fontUnderline ().
返回 display mode of the style.
另请参阅 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.
另请参阅 setFontFamily (), QFont::family (),和 QFont::setFamily ().
Returns true if the style sets an italic font; otherwise returns false.
另请参阅 setFontItalic () 和 definesFontItalic ().
Returns the font size setting of the style. This is either a valid point size or Q3StyleSheetItem::Undefined.
另请参阅 setFontSize (), QFont::pointSize (),和 QFont::setPointSize ().
Returns true if the style sets a strike out font; otherwise returns false.
另请参阅 setFontStrikeOut () 和 definesFontStrikeOut ().
Returns true if the style sets an underlined font; otherwise returns false.
另请参阅 setFontUnderline () 和 definesFontUnderline ().
Returns the font weight setting of the style. This is either a valid QFont::Weight or the value Q3StyleSheetItem::Undefined.
另请参阅 setFontWeight () 和 QFont .
Returns whether this style is an anchor.
另请参阅 setAnchor ().
Returns the line spacing.
Returns the list style of the style.
另请参阅 setListStyle () 和 ListStyle .
Returns the logical font size setting of the style. This is either a valid size between 1 and 7 or Q3StyleSheetItem::Undefined.
另请参阅 setLogicalFontSize (), setLogicalFontSizeStep (), QFont::pointSize (),和 QFont::setPointSize ().
Returns the logical font size step of this style.
The default is 0. Tags such as
big
define
+1
;
small
定义
-1
.
另请参阅 setLogicalFontSizeStep ().
Returns the width of margin m (以像素为单位)。
The margin, m , can be MarginLeft , MarginRight , MarginTop , MarginBottom ,或 MarginFirstLine
Returns the name of the style item.
Returns the number of columns for this style.
另请参阅 setNumberOfColumns (), displayMode (),和 setDisplayMode ().
Returns true if this style has self-nesting enabled; otherwise returns false.
另请参阅 setSelfNesting ().
Sets the alignment to f . This only makes sense for styles with a display mode of DisplayBlock 。可能的值是 Qt::AlignAuto , Qt::AlignLeft , Qt::AlignRight , Qt::AlignCenter or Qt::AlignJustify .
另请参阅 alignment (), displayMode (),和 Qt::Alignment .
若 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.
另请参阅 isAnchor ().
Sets the text color of this style to c .
另请参阅 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.
另请参阅 contexts ().
Sets the display mode of the style to m .
另请参阅 displayMode ().
Sets the font family setting of the style to fam .
另请参阅 fontFamily (), QFont::family (),和 QFont::setFamily ().
若 italic is true sets italic for the style; otherwise sets upright.
另请参阅 fontItalic () 和 definesFontItalic ().
Sets the font size setting of the style to s points.
另请参阅 fontSize (), QFont::pointSize (),和 QFont::setPointSize ().
若 strikeOut is true, sets strike out for the style; otherwise sets no strike out.
另请参阅 fontStrikeOut () 和 definesFontStrikeOut ().
若 underline is true, sets underline for the style; otherwise sets no underline.
另请参阅 fontUnderline () 和 definesFontUnderline ().
Sets the font weight setting of the style to w . Valid values are those defined by QFont::Weight .
另请参阅 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
.
另请参阅 listStyle (), DisplayMode ,和 ListStyle .
Sets the logical font size setting of the style to s . Valid logical sizes are 1 to 7.
另请参阅 logicalFontSize (), QFont::pointSize (),和 QFont::setPointSize ().
Sets the logical font size step of this style to s .
另请参阅 logicalFontSizeStep ().
Sets the width of margin m to v 像素。
The margin,
m
, can be
MarginLeft
,
MarginRight
,
MarginTop
,
MarginBottom
,
MarginFirstLine
,
MarginAll
,
MarginVertical
or
MarginHorizontal
。值
v
must be >= 0.
另请参阅 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 ).
另请参阅 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.
另请参阅 selfNesting ().
Sets the vertical alignment to valign 。可能的值是 VAlignBaseline , VAlignSub or VAlignSuper .
The vertical alignment property is not inherited.
另请参阅 verticalAlignment ().
Sets the whitespace mode to m .
另请参阅 whiteSpaceMode () 和 WhiteSpaceMode .
Returns the style sheet this item is in.
这是重载函数。
Returns the style sheet this item is in.
Returns the vertical alignment of the style. Possible values are VAlignBaseline , VAlignSub or VAlignSuper .
另请参阅 setVerticalAlignment ().
Returns the whitespace mode.
另请参阅 setWhiteSpaceMode () 和 WhiteSpaceMode .
Assignment. Assings a copy of other that is not bound to any style sheet. Unbounds first from previous style sheet.