Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions

QTextCharFormat Class Reference

The QTextCharFormat class provides formatting information for characters in a QTextDocument. More...

#include <QTextCharFormat>

Inherits QTextFormat.

Inherited by QTextImageFormat.

List of all members.

Public Functions


Detailed Description

The QTextCharFormat class provides formatting information for characters in a QTextDocument.

The format's font can be set with setFont(), or piecemeal using setFontFamily(), setFontPointSize(), setFontWeight() (for bold), setFontItalic(), setFontUnderline(), setFontOverline(), setFontStrikeOut(), and setFontFixedPitch(). The color is set with setColor(), and the anchor (for hyperlinks) with setAnchor(), setAnchorHref(), setAnchorName(). The characters can be marked as non-deletable with setNonDeletable().

If the characters are in a table the cell and row spanning characteristics can be set with setTableCellRowSpan() and setTableCellColumnSpan().


Member Function Documentation

QTextCharFormat::QTextCharFormat ()

Constructs a new QTextCharFormat.

QString QTextCharFormat::anchorHref () const

Returns the text format's hypertext link, or an empty string if none has been set.

QString QTextCharFormat::anchorName () const

Returns the text format's hypertext link's name, or an empty string if none has been set.

QColor QTextCharFormat::color () const

Returns the text format's font color.

See also setColor().

QFont QTextCharFormat::font () const

Returns the font for this character format.

QString QTextCharFormat::fontFamily () const

Returns the text format's font family.

See also font().

bool QTextCharFormat::fontFixedPitch () const

Returns true if the text format's font is fixed pitch; otherwise returns false.

See also font().

bool QTextCharFormat::fontItalic () const

Returns true if the text format's font is italic; otherwise returns false.

See also font().

bool QTextCharFormat::fontOverline () const

Returns true if the text format's font is overlined; otherwise returns false.

See also font().

float QTextCharFormat::fontPointSize () const

Returns the text format's font size.

See also font().

bool QTextCharFormat::fontStrikeOut () const

Returns true if the text format's font is struck out; otherwise returns false.

See also font().

bool QTextCharFormat::fontUnderline () const

Returns true if the text format's font is underlined; otherwise returns false.

See also font().

int QTextCharFormat::fontWeight () const

Returns the text format's font weight.

See also font().

bool QTextCharFormat::isAnchor () const

Returns true if the text is formatted as an anchor; otherwise returns false.

See also setAnchor(), setAnchorHref(), and setAnchorName().

bool QTextCharFormat::isValid () const

Returns true if this character format is valid; otherwise returns false.

void QTextCharFormat::setAnchor ( bool anchor )

If anchor is true, sets the text format signify an anchor; otherwise removes anchor formatting. (Anchors are hyperlinks, often shown underlined and in a different color from plain text.)

This is independent of whether or not the format has an anchor. Use setAnchorHref(), and optionally setAnchorName() to create a hypertext link.

See also isAnchor().

void QTextCharFormat::setAnchorHref ( const QString & value )

Sets the anchor's hypertext link to be value. (This is typically a URL like http://www.trolltech.com/index.html.)

The anchor will be displayed using value as its display text; if you want to display different text call setAnchorName().

To format the text as a hypertext link use setAnchor().

void QTextCharFormat::setAnchorName ( const QString & name )

Sets the text format's hypertext link's name to name. For the link to work a hyperlink must be set with setAnchorHref(); use setAnchor() to apply a hyperlink format.

void QTextCharFormat::setColor ( const QColor & color )

Sets the text format's font color to color.

See also color().

void QTextCharFormat::setFont ( const QFont & font )

Sets the character format's font to font.

void QTextCharFormat::setFontFamily ( const QString & family )

Sets the text format's font family to family.

See also setFont().

void QTextCharFormat::setFontFixedPitch ( bool fixedPitch )

Sets the text format's font to be fixed pitch if fixedPitch is true; otherwise to non-fixed pitch.

See also setFont().

void QTextCharFormat::setFontItalic ( bool italic )

Sets the text format's font to be italic if italic is true; otherwise to non-italic.

See also setFont().

void QTextCharFormat::setFontOverline ( bool overline )

Sets the text format's font to be overlined if overline is true; otherwise to non-overlined.

See also setFont().

void QTextCharFormat::setFontPointSize ( float size )

Sets the text format's font size to size.

See also setFont().

void QTextCharFormat::setFontStrikeOut ( bool strikeOut )

Sets the text format's font to be struck out if strikeOut is true; otherwise to non-struck out.

See also setFont().

void QTextCharFormat::setFontUnderline ( bool underline )

Sets the text format's font to be underlined if underline is true; otherwise to non-underlined.

See also setFont().

void QTextCharFormat::setFontWeight ( int weight )

Sets the text format's font weight to weight.

See also setFont().

void QTextCharFormat::setTableCellColumnSpan ( int tableCellColumnSpan )

If this character format is applied to characters in a table cell, the cell will span tableCellColumnSpan columns.

void QTextCharFormat::setTableCellRowSpan ( int tableCellRowSpan )

If this character format is applied to characters in a table cell, the cell will span tableCellRowSpan rows.

int QTextCharFormat::tableCellColumnSpan () const

If this character format is applied to characters in a table cell, returns the number of columns spanned which may be 1. Otherwise returns 1.

int QTextCharFormat::tableCellRowSpan () const

If this character format is applied to characters in a table cell, returns the number of rows spanned which may be 1. Otherwise returns 1.


Copyright © 2004 Trolltech. Trademarks
Qt 4.0.0-tp1