
We bake cookies in your browser for a better experience. Using this site means that you consent.Read More
TheQ3StyleSheetItem class provides an encapsulation of a set of text styles.More...
| Header: | #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) |
TheQ3StyleSheetItem 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 astyle sheet (seestyleSheet()), items define thename() of a rich text tag and the display property changes associated with it.
Thedisplay mode attribute indicates whether the item is a block, an inline element or a list element; seesetDisplayMode(). The treatment of whitespace is controlled by thewhite space mode; seesetWhiteSpaceMode(). An item's margins are set withsetMargin(), In the case of list items, the list style is set withsetListStyle(). An item may be a hypertext link anchor; seesetAnchor(). Other attributes are set withsetAlignment(),setVerticalAlignment(),setFontFamily(),setFontSize(),setFontWeight(),setFontItalic(),setFontUnderline(),setFontStrikeOut andsetColor().
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 whichQ3StyleSheet 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 calledname for the stylesheetparent.
All properties inQ3StyleSheetItem are initially in the "do not change" state, exceptdisplay mode, which defaults toDisplayInline.
Copy constructor. Constructs a copy ofother that is not bound to any style sheet.
Destroys the style. Note thatQ3StyleSheetItem objects become owned byQ3StyleSheet when they are created.
Returns the alignment of this style. Possible values areQt::AlignAuto,Qt::AlignLeft,Qt::AlignRight,Qt::AlignCenter orQt::AlignJustify.
See alsosetAlignment() andQt::Alignment.
Returns true if this style can be nested into an element of styles; otherwise returns false.
See alsocontexts() andsetContexts().
Returns the text color of this style or an invalid color if no color has been set.
See alsosetColor() andQColor::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 alsosetContexts().
Returns true if the style defines a font shape; otherwise returns false. A style does not define any shape untilsetFontItalic() is called.
See alsosetFontItalic() andfontItalic().
Returns true if the style defines a setting for the strikeOut property of the font; otherwise returns false. A style does not define this untilsetFontStrikeOut() is called.
See alsosetFontStrikeOut() andfontStrikeOut().
Returns true if the style defines a setting for the underline property of the font; otherwise returns false. A style does not define this untilsetFontUnderline() is called.
See alsosetFontUnderline() andfontUnderline().
Returns thedisplay mode of the style.
See alsosetDisplayMode().
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 alsosetFontFamily(),QFont::family(), andQFont::setFamily().
Returns true if the style sets an italic font; otherwise returns false.
See alsosetFontItalic() anddefinesFontItalic().
Returns the font size setting of the style. This is either a valid point size or Q3StyleSheetItem::Undefined.
See alsosetFontSize(),QFont::pointSize(), andQFont::setPointSize().
Returns true if the style sets a strike out font; otherwise returns false.
See alsosetFontStrikeOut() anddefinesFontStrikeOut().
Returns true if the style sets an underlined font; otherwise returns false.
See alsosetFontUnderline() anddefinesFontUnderline().
Returns the font weight setting of the style. This is either a validQFont::Weight or the value Q3StyleSheetItem::Undefined.
See alsosetFontWeight() andQFont.
Returns whether this style is an anchor.
See alsosetAnchor().
Returns the line spacing.
Returns the list style of the style.
See alsosetListStyle() andListStyle.
Returns the logical font size setting of the style. This is either a valid size between 1 and 7 or Q3StyleSheetItem::Undefined.
See alsosetLogicalFontSize(),setLogicalFontSizeStep(),QFont::pointSize(), andQFont::setPointSize().
Returns the logical font size step of this style.
The default is 0. Tags such asbig define+1;small defines-1.
See alsosetLogicalFontSizeStep().
Returns the width of marginm in pixels.
The margin,m, can beMarginLeft,MarginRight,MarginTop,MarginBottom, orMarginFirstLine
See alsosetMargin() andMargin.
Returns the name of the style item.
Returns the number of columns for this style.
See alsosetNumberOfColumns(),displayMode(), andsetDisplayMode().
Returns true if this style has self-nesting enabled; otherwise returns false.
See alsosetSelfNesting().
Sets the alignment tof. This only makes sense for styles with adisplay mode ofDisplayBlock. Possible values areQt::AlignAuto,Qt::AlignLeft,Qt::AlignRight,Qt::AlignCenter orQt::AlignJustify.
See alsoalignment(),displayMode(), andQt::Alignment.
Ifanc 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 alsoisAnchor().
Sets the text color of this style toc.
See alsocolor().
Sets a space-separated list of names of styles that may contain elements of this style. Ifc is empty, the style can be nested everywhere.
See alsocontexts().
Sets the display mode of the style tom.
See alsodisplayMode().
Sets the font family setting of the style tofam.
See alsofontFamily(),QFont::family(), andQFont::setFamily().
Ifitalic is true sets italic for the style; otherwise sets upright.
See alsofontItalic() anddefinesFontItalic().
Sets the font size setting of the style tos points.
See alsofontSize(),QFont::pointSize(), andQFont::setPointSize().
IfstrikeOut is true, sets strike out for the style; otherwise sets no strike out.
See alsofontStrikeOut() anddefinesFontStrikeOut().
Ifunderline is true, sets underline for the style; otherwise sets no underline.
See alsofontUnderline() anddefinesFontUnderline().
Sets the font weight setting of the style tow. Valid values are those defined byQFont::Weight.
See alsoQFont andfontWeight().
Sets the list style of the style tos.
This is used by nested elements that have a display mode ofDisplayListItem.
See alsolistStyle(),DisplayMode, andListStyle.
Sets the logical font size setting of the style tos. Valid logical sizes are 1 to 7.
See alsologicalFontSize(),QFont::pointSize(), andQFont::setPointSize().
Sets the logical font size step of this style tos.
See alsologicalFontSizeStep().
Sets the width of marginm tov pixels.
The margin,m, can beMarginLeft,MarginRight,MarginTop,MarginBottom,MarginFirstLine,MarginAll,MarginVertical orMarginHorizontal. The valuev must be >= 0.
See alsomargin().
Sets the number of columns for this style toncols. Elements in the style are divided into columns.
This makes sense only if the style uses a block display mode (seeQ3StyleSheetItem::DisplayMode).
See alsonumberOfColumns().
Sets the self-nesting property for this style tonesting.
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 alsoselfNesting().
Sets the vertical alignment tovalign. Possible values areVAlignBaseline,VAlignSub orVAlignSuper.
The vertical alignment property is not inherited.
See alsoverticalAlignment().
Sets the whitespace mode tom.
See alsowhiteSpaceMode() andWhiteSpaceMode.
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 areVAlignBaseline,VAlignSub orVAlignSuper.
See alsosetVerticalAlignment().
Returns the whitespace mode.
See alsosetWhiteSpaceMode() andWhiteSpaceMode.
Assignment. Assings a copy ofother that is not bound to any style sheet. Unbounds first from previous style sheet.
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.