Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

Q3StyleSheetItem Class Reference

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.

Public Types

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 }

Public Functions

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 )

Detailed Description

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

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 which Q3StyleSheet 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, const QString & name )

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.

Q3StyleSheetItem::Q3StyleSheetItem ( const Q3StyleSheetItem & other )

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

Q3StyleSheetItem::~Q3StyleSheetItem ()

Destroys the style. Note that Q3StyleSheetItem objects become owned by Q3StyleSheet when they are created.

int Q3StyleSheetItem::alignment () const

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.

bool Q3StyleSheetItem::allowedInContext ( const Q3StyleSheetItem * s ) const

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

See also contexts() and setContexts().

QColor Q3StyleSheetItem::color () const

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

See also setColor() and QColor::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 also setContexts().

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

See also setFontItalic() and fontItalic().

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 until setFontStrikeOut() is called.

See also setFontStrikeOut() and fontStrikeOut().

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 until setFontUnderline() is called.

See also setFontUnderline() and fontUnderline().

DisplayMode Q3StyleSheetItem::displayMode () const

Returns the display mode of the style.

See also setDisplayMode().

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 also setFontFamily(), QFont::family(), and QFont::setFamily().

bool Q3StyleSheetItem::fontItalic () const

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

See also setFontItalic() and definesFontItalic().

int Q3StyleSheetItem::fontSize () const

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

bool Q3StyleSheetItem::fontStrikeOut () const

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

See also setFontStrikeOut() and definesFontStrikeOut().

bool Q3StyleSheetItem::fontUnderline () const

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

See also setFontUnderline() and definesFontUnderline().

int Q3StyleSheetItem::fontWeight () const

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.

bool Q3StyleSheetItem::isAnchor () const

Returns whether this style is an anchor.

See also setAnchor().

int Q3StyleSheetItem::lineSpacing () const

Returns the line spacing.

ListStyle Q3StyleSheetItem::listStyle () const

Returns the list style of the style.

See also setListStyle() and ListStyle.

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 also setLogicalFontSize(), setLogicalFontSizeStep(), QFont::pointSize(), and QFont::setPointSize().

int Q3StyleSheetItem::logicalFontSizeStep () const

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

int Q3StyleSheetItem::margin ( Margin m ) const

Returns the width of margin m in pixels.

The margin, m, can be MarginLeft, MarginRight, MarginTop, MarginBottom, or MarginFirstLine

See also setMargin() and Margin.

QString Q3StyleSheetItem::name () const

Returns the name of the style item.

int Q3StyleSheetItem::numberOfColumns () const

Returns the number of columns for this style.

See also setNumberOfColumns(), displayMode(), and setDisplayMode().

bool Q3StyleSheetItem::selfNesting () const

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

See also setSelfNesting().

void Q3StyleSheetItem::setAlignment ( int f )

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.

void Q3StyleSheetItem::setAnchor ( bool anc )

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

void Q3StyleSheetItem::setColor ( const QColor & c )

Sets the text color of this style to c.

See also color().

void Q3StyleSheetItem::setContexts ( const QString & c )

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

void Q3StyleSheetItem::setDisplayMode ( DisplayMode m )

Sets the display mode of the style to m.

See also displayMode().

void Q3StyleSheetItem::setFontFamily ( const QString & fam )

Sets the font family setting of the style to fam.

See also fontFamily(), QFont::family(), and QFont::setFamily().

void Q3StyleSheetItem::setFontItalic ( bool italic )

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

See also fontItalic() and definesFontItalic().

void Q3StyleSheetItem::setFontSize ( int s )

Sets the font size setting of the style to s points.

See also fontSize(), QFont::pointSize(), and QFont::setPointSize().

void Q3StyleSheetItem::setFontStrikeOut ( bool strikeOut )

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

See also fontStrikeOut() and definesFontStrikeOut().

void Q3StyleSheetItem::setFontUnderline ( bool underline )

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

See also fontUnderline() and definesFontUnderline().

void Q3StyleSheetItem::setFontWeight ( int w )

Sets the font weight setting of the style to w. Valid values are those defined by QFont::Weight.

See also QFont and fontWeight().

void Q3StyleSheetItem::setListStyle ( ListStyle s )

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.

void Q3StyleSheetItem::setLogicalFontSize ( int s )

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

void Q3StyleSheetItem::setLogicalFontSizeStep ( int s )

Sets the logical font size step of this style to s.

See also logicalFontSizeStep().

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

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

void Q3StyleSheetItem::setNumberOfColumns ( int ncols )

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

void Q3StyleSheetItem::setSelfNesting ( bool nesting )

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

void Q3StyleSheetItem::setVerticalAlignment ( VerticalAlignment valign )

Sets the vertical alignment to valign. Possible values are VAlignBaseline, VAlignSub or VAlignSuper.

The vertical alignment property is not inherited.

See also verticalAlignment().

void Q3StyleSheetItem::setWhiteSpaceMode ( WhiteSpaceMode m )

Sets the whitespace mode to m.

See also whiteSpaceMode() and WhiteSpaceMode.

Q3StyleSheet * Q3StyleSheetItem::styleSheet ()

Returns the style sheet this item is in.

const Q3StyleSheet * 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 are VAlignBaseline, VAlignSub or VAlignSuper.

See also setVerticalAlignment().

WhiteSpaceMode Q3StyleSheetItem::whiteSpaceMode () const

Returns the whitespace mode.

See also setWhiteSpaceMode() and WhiteSpaceMode.

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

Assignment. Assings a copy of other that is not bound to any style sheet. Unbounds first from previous style sheet.

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.8
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web