Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

  • Qt 4.8
  • Qt3SupportLight
  • Q3StyleSheetItem

Q3StyleSheetItem Class

TheQ3StyleSheetItem class provides an encapsulation of a set of text styles.More...

Header:#include <Q3StyleSheetItem>

Public Types

enumDisplayMode { DisplayBlock, DisplayInline, DisplayListItem, DisplayNone }
enumListStyle { ListDisc, ListCircle, ListSquare, ListDecimal, ListLowerAlpha, ListUpperAlpha }
enumMargin { MarginLeft, MarginRight, MarginTop, MarginBottom, ..., MarginUndefined }
enumVerticalAlignment { VAlignBaseline, VAlignSub, VAlignSuper }
enumWhiteSpaceMode { WhiteSpaceNormal, WhiteSpacePre, WhiteSpaceNoWrap }

Public Functions

Q3StyleSheetItem(Q3StyleSheet * parent, const QString & name)
Q3StyleSheetItem(const Q3StyleSheetItem & other)
~Q3StyleSheetItem()
intalignment() const
boolallowedInContext(const Q3StyleSheetItem * s) const
QColorcolor() const
QStringcontexts() const
booldefinesFontItalic() const
booldefinesFontStrikeOut() const
booldefinesFontUnderline() const
DisplayModedisplayMode() const
QStringfontFamily() const
boolfontItalic() const
intfontSize() const
boolfontStrikeOut() const
boolfontUnderline() const
intfontWeight() const
boolisAnchor() const
intlineSpacing() const
ListStylelistStyle() const
intlogicalFontSize() const
intlogicalFontSizeStep() const
intmargin(Margin m) const
QStringname() const
intnumberOfColumns() const
boolselfNesting() const
voidsetAlignment(int f)
voidsetAnchor(bool anc)
voidsetColor(const QColor & c)
voidsetContexts(const QString & c)
voidsetDisplayMode(DisplayMode m)
voidsetFontFamily(const QString & fam)
voidsetFontItalic(bool italic)
voidsetFontSize(int s)
voidsetFontStrikeOut(bool strikeOut)
voidsetFontUnderline(bool underline)
voidsetFontWeight(int w)
voidsetListStyle(ListStyle s)
voidsetLogicalFontSize(int s)
voidsetLogicalFontSizeStep(int s)
voidsetMargin(Margin m, int v)
voidsetNumberOfColumns(int ncols)
voidsetSelfNesting(bool nesting)
voidsetVerticalAlignment(VerticalAlignment valign)
voidsetWhiteSpaceMode(WhiteSpaceMode m)
Q3StyleSheet *styleSheet()
const Q3StyleSheet *styleSheet() const
VerticalAlignmentverticalAlignment() const
WhiteSpaceModewhiteSpaceMode() const
Q3StyleSheetItem &operator=(const Q3StyleSheetItem & other)

Detailed Description

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().

Member Type Documentation

enum Q3StyleSheetItem::DisplayMode

This enum type defines the way adjacent elements are displayed.

ConstantValueDescription
Q3StyleSheetItem::DisplayBlock0elements are displayed as a rectangular block (e.g.<p>...</p>).
Q3StyleSheetItem::DisplayInline1elements are displayed in a horizontally flowing sequence (e.g.<em>...</em>).
Q3StyleSheetItem::DisplayListItem2elements are displayed in a vertical sequence (e.g.<li>...</li>).
Q3StyleSheetItem::DisplayNone3elements are not displayed at all.

enum Q3StyleSheetItem::ListStyle

This enum type defines how the items in a list are prefixed when displayed.

ConstantValueDescription
Q3StyleSheetItem::ListDisc0a filled circle (i.e. a bullet)
Q3StyleSheetItem::ListCircle1an unfilled circle
Q3StyleSheetItem::ListSquare2a filled square
Q3StyleSheetItem::ListDecimal3an integer in base 10:1,2,3, ...
Q3StyleSheetItem::ListLowerAlpha4a lowercase letter:a,b,c, ...
Q3StyleSheetItem::ListUpperAlpha5an uppercase letter:A,B,C, ...

enum Q3StyleSheetItem::Margin

ConstantValueDescription
Q3StyleSheetItem::MarginLeft0left margin
Q3StyleSheetItem::MarginRight1right margin
Q3StyleSheetItem::MarginTop2top margin
Q3StyleSheetItem::MarginBottom3bottom margin
Q3StyleSheetItem::MarginAll5all margins (left, right, top and bottom)
Q3StyleSheetItem::MarginVertical6top and bottom margins
Q3StyleSheetItem::MarginHorizontal7left and right margins
Q3StyleSheetItem::MarginFirstLine4margin (indentation) of the first line of a paragarph (in addition to the MarginLeft of the paragraph)
Q3StyleSheetItem::MarginUndefined-1 

enum Q3StyleSheetItem::VerticalAlignment

This enum type defines the way elements are aligned vertically. This is only supported for text elements.

ConstantValueDescription
Q3StyleSheetItem::VAlignBaseline0align the baseline of the element (or the bottom, if the element doesn't have a baseline) with the baseline of the parent
Q3StyleSheetItem::VAlignSub1subscript the element
Q3StyleSheetItem::VAlignSuper2superscript the element

enum Q3StyleSheetItem::WhiteSpaceMode

This enum defines the ways in whichQ3StyleSheet can treat whitespace.

ConstantValueDescription
Q3StyleSheetItem::WhiteSpaceNormal0any sequence of whitespace (including line-breaks) is equivalent to a single space.
Q3StyleSheetItem::WhiteSpacePre1whitespace must be output exactly as given in the input.
Q3StyleSheetItem::WhiteSpaceNoWrap2multiple spaces are collapsed as with WhiteSpaceNormal, but no automatic line-breaks occur. To break lines manually, use the<br> tag.

Member Function Documentation

Q3StyleSheetItem::Q3StyleSheetItem(Q3StyleSheet * parent, constQString & name)

Constructs a new style calledname for the stylesheetparent.

All properties inQ3StyleSheetItem are initially in the "do not change" state, exceptdisplay mode, which defaults toDisplayInline.

Q3StyleSheetItem::Q3StyleSheetItem(constQ3StyleSheetItem & other)

Copy constructor. Constructs a copy ofother that is not bound to any style sheet.

Q3StyleSheetItem::~Q3StyleSheetItem()

Destroys the style. Note thatQ3StyleSheetItem objects become owned byQ3StyleSheet when they are created.

int Q3StyleSheetItem::alignment() const

Returns the alignment of this style. Possible values areQt::AlignAuto,Qt::AlignLeft,Qt::AlignRight,Qt::AlignCenter orQt::AlignJustify.

See alsosetAlignment() andQt::Alignment.

bool Q3StyleSheetItem::allowedInContext(constQ3StyleSheetItem * s) const

Returns true if this style can be nested into an element of styles; otherwise returns false.

See alsocontexts() andsetContexts().

QColor Q3StyleSheetItem::color() const

Returns the text color of this style or an invalid color if no color has been set.

See alsosetColor() andQColor::isValid().

QString Q3StyleSheetItem::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.

See alsosetContexts().

bool Q3StyleSheetItem::definesFontItalic() const

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().

bool Q3StyleSheetItem::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 untilsetFontStrikeOut() is called.

See alsosetFontStrikeOut() andfontStrikeOut().

bool Q3StyleSheetItem::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 untilsetFontUnderline() is called.

See alsosetFontUnderline() andfontUnderline().

DisplayMode Q3StyleSheetItem::displayMode() const

Returns thedisplay mode of the style.

See alsosetDisplayMode().

QString Q3StyleSheetItem::fontFamily() const

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().

bool Q3StyleSheetItem::fontItalic() const

Returns true if the style sets an italic font; otherwise returns false.

See alsosetFontItalic() anddefinesFontItalic().

int Q3StyleSheetItem::fontSize() const

Returns the font size setting of the style. This is either a valid point size or Q3StyleSheetItem::Undefined.

See alsosetFontSize(),QFont::pointSize(), andQFont::setPointSize().

bool Q3StyleSheetItem::fontStrikeOut() const

Returns true if the style sets a strike out font; otherwise returns false.

See alsosetFontStrikeOut() anddefinesFontStrikeOut().

bool Q3StyleSheetItem::fontUnderline() const

Returns true if the style sets an underlined font; otherwise returns false.

See alsosetFontUnderline() anddefinesFontUnderline().

int Q3StyleSheetItem::fontWeight() const

Returns the font weight setting of the style. This is either a validQFont::Weight or the value Q3StyleSheetItem::Undefined.

See alsosetFontWeight() andQFont.

bool Q3StyleSheetItem::isAnchor() const

Returns whether this style is an anchor.

See alsosetAnchor().

int Q3StyleSheetItem::lineSpacing() const

Returns the line spacing.

ListStyle Q3StyleSheetItem::listStyle() const

Returns the list style of the style.

See alsosetListStyle() andListStyle.

int Q3StyleSheetItem::logicalFontSize() const

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().

int Q3StyleSheetItem::logicalFontSizeStep() const

Returns the logical font size step of this style.

The default is 0. Tags such asbig define+1;small defines-1.

See alsosetLogicalFontSizeStep().

int Q3StyleSheetItem::margin(Margin m) const

Returns the width of marginm in pixels.

The margin,m, can beMarginLeft,MarginRight,MarginTop,MarginBottom, orMarginFirstLine

See alsosetMargin() andMargin.

QString Q3StyleSheetItem::name() const

Returns the name of the style item.

int Q3StyleSheetItem::numberOfColumns() const

Returns the number of columns for this style.

See alsosetNumberOfColumns(),displayMode(), andsetDisplayMode().

bool Q3StyleSheetItem::selfNesting() const

Returns true if this style has self-nesting enabled; otherwise returns false.

See alsosetSelfNesting().

void Q3StyleSheetItem::setAlignment(int f)

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.

void Q3StyleSheetItem::setAnchor(bool anc)

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().

void Q3StyleSheetItem::setColor(constQColor & c)

Sets the text color of this style toc.

See alsocolor().

void Q3StyleSheetItem::setContexts(constQString & c)

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().

void Q3StyleSheetItem::setDisplayMode(DisplayMode m)

Sets the display mode of the style tom.

See alsodisplayMode().

void Q3StyleSheetItem::setFontFamily(constQString & fam)

Sets the font family setting of the style tofam.

See alsofontFamily(),QFont::family(), andQFont::setFamily().

void Q3StyleSheetItem::setFontItalic(bool italic)

Ifitalic is true sets italic for the style; otherwise sets upright.

See alsofontItalic() anddefinesFontItalic().

void Q3StyleSheetItem::setFontSize(int s)

Sets the font size setting of the style tos points.

See alsofontSize(),QFont::pointSize(), andQFont::setPointSize().

void Q3StyleSheetItem::setFontStrikeOut(bool strikeOut)

IfstrikeOut is true, sets strike out for the style; otherwise sets no strike out.

See alsofontStrikeOut() anddefinesFontStrikeOut().

void Q3StyleSheetItem::setFontUnderline(bool underline)

Ifunderline is true, sets underline for the style; otherwise sets no underline.

See alsofontUnderline() anddefinesFontUnderline().

void Q3StyleSheetItem::setFontWeight(int w)

Sets the font weight setting of the style tow. Valid values are those defined byQFont::Weight.

See alsoQFont andfontWeight().

void Q3StyleSheetItem::setListStyle(ListStyle s)

Sets the list style of the style tos.

This is used by nested elements that have a display mode ofDisplayListItem.

See alsolistStyle(),DisplayMode, andListStyle.

void Q3StyleSheetItem::setLogicalFontSize(int s)

Sets the logical font size setting of the style tos. Valid logical sizes are 1 to 7.

See alsologicalFontSize(),QFont::pointSize(), andQFont::setPointSize().

void Q3StyleSheetItem::setLogicalFontSizeStep(int s)

Sets the logical font size step of this style tos.

See alsologicalFontSizeStep().

void Q3StyleSheetItem::setMargin(Margin m,int v)

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().

void Q3StyleSheetItem::setNumberOfColumns(int ncols)

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().

void Q3StyleSheetItem::setSelfNesting(bool nesting)

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().

void Q3StyleSheetItem::setVerticalAlignment(VerticalAlignment valign)

Sets the vertical alignment tovalign. Possible values areVAlignBaseline,VAlignSub orVAlignSuper.

The vertical alignment property is not inherited.

See alsoverticalAlignment().

void Q3StyleSheetItem::setWhiteSpaceMode(WhiteSpaceMode m)

Sets the whitespace mode tom.

See alsowhiteSpaceMode() andWhiteSpaceMode.

Q3StyleSheet * Q3StyleSheetItem::styleSheet()

Returns the style sheet this item is in.

constQ3StyleSheet * Q3StyleSheetItem::styleSheet() const

This is an overloaded function.

Returns the style sheet this item is in.

VerticalAlignment Q3StyleSheetItem::verticalAlignment() const

Returns the vertical alignment of the style. Possible values areVAlignBaseline,VAlignSub orVAlignSuper.

See alsosetVerticalAlignment().

WhiteSpaceMode Q3StyleSheetItem::whiteSpaceMode() const

Returns the whitespace mode.

See alsosetWhiteSpaceMode() andWhiteSpaceMode.

Q3StyleSheetItem & Q3StyleSheetItem::operator=(constQ3StyleSheetItem & other)

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.


[8]ページ先頭

©2009-2025 Movatter.jp