![]() |
Home · All Classes · Main Classes · Annotated · Grouped Classes · Functions | ![]() |
The QTextCharFormat class provides formatting information for characters in a QTextDocument. More...
#include <QTextCharFormat>
Part of the QtGui module.
Inherits QTextFormat.
Inherited by QTextImageFormat.
The QTextCharFormat class provides formatting information for characters in a QTextDocument.
The character format of text in a document specifies the visual properties of the text, as well as information about its role in a hypertext document.
The font used can be set by supplying a font to the setFont() function, and each aspect of its appearance can be adjusted to give the desired effect. setFontFamily() and setFontPointSize() define the font's family (e.g. Times) and printed size; setFontWeight() and setFontItalic() provide control over the style of the font. setFontUnderline(), setFontOverline(), setFontStrikeOut(), and setFontFixedPitch() provide additional effects for text.
The color is set with setTextColor(). If the text is intended to be used as an anchor (for hyperlinks), this can be enabled with setAnchor(). The setAnchorHref() and setAnchorName() functions are used to specify the information about the hyperlink's destination and the anchor's name.
If the text is written within a table, it can be made to span a number of rows and columns with the setTableCellRowSpan() and setTableCellColumnSpan() functions.
See also QTextFormat, QTextBlockFormat, QTextTableFormat, and QTextListFormat.
This enum describes the ways that adjacent characters can be vertically aligned.
Constant | Value | Description |
---|---|---|
QTextCharFormat::AlignNormal | 0 | Adjacent characters are positioned in the standard way for text in the writing system in use. |
QTextCharFormat::AlignSuperScript | 1 | Characters are placed above the baseline for normal text. |
QTextCharFormat::AlignSubScript | 2 | Characters are placed below the baseline for normal text. |
Constructs a new character format object.
Returns the text format's hypertext link, or an empty string if none has been set.
Returns the anchor name associated with this text format, or an empty string if none has been set. If the anchor name is set, text with this format can be the destination of a hypertext link.
Returns the font for this character format.
Returns the text format's font family.
See also font().
Returns true if the text format's font is fixed pitch; otherwise returns false.
See also font().
Returns true if the text format's font is italic; otherwise returns false.
See also font().
Returns true if the text format's font is overlined; otherwise returns false.
See also font().
Returns the font size used to display text in this format.
See also font().
Returns true if the text format's font is struck out (has a horizontal line drawn through it); otherwise returns false.
See also font().
Returns true if the text format's font is underlined; otherwise returns false.
See also font().
Returns the text format's font weight.
See also font().
Returns true if the text is formatted as an anchor; otherwise returns false.
See also setAnchor(), setAnchorHref(), and setAnchorName().
Returns true if this character format is valid; otherwise returns false.
If anchor is true, text with this format represents an anchor, and is formatted in the appropriate way; otherwise the text is formatted normally. (Anchors are hyperlinks which are often shown underlined and in a different color from plain text.)
The way the text is rendered is independent of whether or not the format has a valid anchor defined. Use setAnchorHref(), and optionally setAnchorName() to create a hypertext link.
See also isAnchor().
Sets the hypertext link for the text format to the given value. This is typically a URL like "http://www.trolltech.com/index.html".
The anchor will be displayed with the value as its display text; if you want to display different text call setAnchorName().
To format the text as a hypertext link use setAnchor().
Sets the text format's anchor name. For the anchor to work as a hyperlink, the destination must be set with setAnchorHref() and the anchor must be enabled with setAnchor().
Sets the text format's font.
Sets the text format's font family.
See also setFont().
If fixedPitch is true, sets the text format's font to be fixed pitch; otherwise a non-fixed pitch font is used.
See also setFont().
If italic is true, sets the text format's font to be italic; otherwise the font will be non-italic.
See also setFont().
If overline is true, sets the text format's font to be overlined; otherwise the font is displayed non-overlined.
See also setFont().
Sets the text format's font size.
See also setFont().
If strikeOut is true, sets the text format's font with strike-out enabled (with a horizontal line through it); otherwise it is displayed without strikeout.
See also setFont().
If underline is true, sets the text format's font to be underlined; otherwise it is displayed non-underlined.
See also setFont().
Sets the text format's font weight to weight.
See also setFont().
If this character format is applied to characters in a table cell, the cell will span tableCellColumnSpan columns.
If this character format is applied to characters in a table cell, the cell will span tableCellRowSpan rows.
Sets the underline color used for the characters with this format to the color specified.
See also underlineColor().
Sets the vertical alignment used for the characters with this format to the alignment specified.
See also verticalAlignment().
If this character format is applied to characters in a table cell, this function returns the number of columns spanned by the text (this may be 1); otherwise it returns 1.
If this character format is applied to characters in a table cell, this function returns the number of rows spanned by the text (this may be 1); otherwise it returns 1.
Returns the color used to underline the characters with this format.
See also setUnderlineColor().
Returns the vertical alignment used for characters with this format.
See also setVerticalAlignment().
Copyright © 2005 Trolltech | Trademarks | Qt 4.0.0-b2 |