Qt:Документация 4.3.2/q3stylesheetitem

Материал из Wiki.crossplatform.ru

Перейти к: навигация, поиск
40px Внимание: Актуальная версия перевода документации находится здесь

__NOTOC__

Image:qt-logo.png

Главная · Все классы · Основные классы · Классы по группам · Модули · Функции

Image:trolltech-logo.png

Содержание

[править] Q3StyleSheetItem Class Reference
[ Qt3Support module]

The Q3StyleSheetItem class provides an encapsulation of a set of text styles. Далее...

 #include <Q3StyleSheetItem>

This class is part of the Qt 3 support library. It is provided to keep old source code working. Мы настоятельно не рекомендуем использовать этот класс в новом коде. 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 }

[править] Открытые функции


[править] Подробное описание

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


[править] Описание типов

[править]
enum Q3StyleSheetItem::DisplayMode

This enum type defines the way adjacent elements are displayed.


Константа Значение Описание
Q3StyleSheetItem::DisplayBlock 0 elements are displayed as a rectangular block (e.g.

...

).
Q3StyleSheetItem::DisplayInline 1 elements are displayed in a horizontally flowing sequence (e.g. ...).
Q3StyleSheetItem::DisplayListItem 2 elements are displayed in a vertical sequence (e.g.
  • ...</li>).
  • Q3StyleSheetItem::DisplayNone 3 elements are not displayed at all.

    [править]
    enum Q3StyleSheetItem::ListStyle

    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 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, ...

    [править]
    enum Q3StyleSheetItem::Margin

    Константа Значение Описание
    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

    [править]
    enum Q3StyleSheetItem::VerticalAlignment

    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

    [править]
    enum Q3StyleSheetItem::WhiteSpaceMode

    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
    tag.

    [править] Описание функций-членов

    [править]
    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 ()

    Уничтожает объект стиля. 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.

    Смотрите также 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

    </tt> and list items <tt>

  • </tt> 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

    Эта перегруженная функция предоставлена для удобства.

    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.



    Copyright © 2007 Trolltech Trademarks
    Qt 4.3.2