Qt Jambi Home

com.trolltech.qt.gui
Class QTextCharFormat

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.gui.QTextFormat
              extended by com.trolltech.qt.gui.QTextCharFormat
All Implemented Interfaces:
QtJambiInterface
Direct Known Subclasses:
QTextImageFormat

public class QTextCharFormat
extends QTextFormat

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 setForeground. If the text is intended to be used as an anchor (for hyperlinks), this can be enabled with setAnchor. The setAnchorHref and setAnchorNames functions are used to specify the information about the hyperlink's destination and the anchor's name.

See Also:
QTextFormat, QTextBlockFormat, QTextTableFormat, QTextListFormat

Nested Class Summary
static class QTextCharFormat.UnderlineStyle
          This enum describes the different ways drawing underlined text.
static class QTextCharFormat.VerticalAlignment
          This enum describes the ways that adjacent characters can be vertically aligned.
 
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QTextFormat
QTextFormat.FormatType, QTextFormat.ObjectTypes, QTextFormat.PageBreakFlag, QTextFormat.PageBreakFlags, QTextFormat.Property
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
Constructor Summary
QTextCharFormat()
          Constructs a new character format object.
 
Method Summary
 java.lang.String anchorHref()
          Returns the text format's hypertext link, or an empty string if none has been set.
 java.util.List<java.lang.String> anchorNames()
          Returns the anchor names associated with this text format, or an empty string list if none has been set.
 QFont font()
          Returns the font for this character format.
 java.lang.String fontFamily()
          Returns the text format's font family.
 boolean fontFixedPitch()
          Returns true if the text format's font is fixed pitch; otherwise returns false.
 boolean fontItalic()
          Returns true if the text format's font is italic; otherwise returns false.
 boolean fontOverline()
          Returns true if the text format's font is overlined; otherwise returns false.
 double fontPointSize()
          Returns the font size used to display text in this format.
 boolean fontStrikeOut()
          Returns true if the text format's font is struck out (has a horizontal line drawn through it); otherwise returns false.
 boolean fontUnderline()
          Returns true if the text format's font is underlined; otherwise returns false.
 int fontWeight()
          Returns the text format's font weight.
static QTextCharFormat fromNativePointer(QNativePointer nativePointer)
          This function returns the QTextCharFormat instance pointed to by nativePointer
 boolean isAnchor()
          Returns true if the text is formatted as an anchor; otherwise returns false.
 boolean isValid()
          Returns true if this character format is valid; otherwise returns false.
static QNativePointer nativePointerArray(QTextCharFormat[] array)
          This function returns a QNativePointer that is pointing to the specified QTextCharFormat array.
 void setAnchor(boolean anchor)
          If anchor is true, text with this format represents an anchor, and is formatted in the appropriate way; otherwise the text is formatted normally.
 void setAnchorHref(java.lang.String value)
          Sets the hypertext link for the text format to the given value.
 void setAnchorNames(java.util.List<java.lang.String> names)
          Sets the text format's anchor names.
 void setFont(QFont font)
          Sets the text format's font.
 void setFontFamily(java.lang.String family)
          Sets the text format's font family.
 void setFontFixedPitch(boolean fixedPitch)
          If fixedPitch is true, sets the text format's font to be fixed pitch; otherwise a non-fixed pitch font is used.
 void setFontItalic(boolean italic)
          If italic is true, sets the text format's font to be italic; otherwise the font will be non-italic.
 void setFontOverline(boolean overline)
          If overline is true, sets the text format's font to be overlined; otherwise the font is displayed non-overlined.
 void setFontPointSize(double size)
          Sets the text format's font size.
 void setFontStrikeOut(boolean strikeOut)
          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.
 void setFontUnderline(boolean underline)
          If underline is true, sets the text format's font to be underlined; otherwise it is displayed non-underlined.
 void setFontWeight(int weight)
          Sets the text format's font weight to weight.
 void setTableCellColumnSpan(int tableCellColumnSpan)
          
 void setTableCellRowSpan(int tableCellRowSpan)
          
 void setTextOutline(QPen pen)
          Sets the pen used to draw the outlines of characters to the given pen.
 void setToolTip(java.lang.String tip)
          Sets the tool tip for a fragment of text to the given tip.
 void setUnderlineColor(QColor color)
          Sets the underline color used for the characters with this format to the color specified.
 void setUnderlineStyle(QTextCharFormat.UnderlineStyle style)
          Sets the style of underlining the text to style.
 void setVerticalAlignment(QTextCharFormat.VerticalAlignment alignment)
          Sets the vertical alignment used for the characters with this format to the alignment specified.
 int tableCellColumnSpan()
          
 int tableCellRowSpan()
          
 QPen textOutline()
          Returns the pen used to draw the outlines of characters in this format.
 java.lang.String toolTip()
          Returns the tool tip that is displayed for a fragment of text.
 QColor underlineColor()
          Returns the color used to underline the characters with this format.
 QTextCharFormat.UnderlineStyle underlineStyle()
          Returns the style of underlining the text.
 QTextCharFormat.VerticalAlignment verticalAlignment()
          Returns the vertical alignment used for characters with this format.
 
Methods inherited from class com.trolltech.qt.gui.QTextFormat
background, boolProperty, brushProperty, clearBackground, clearForeground, clearProperty, colorProperty, doubleProperty, equals, foreground, hasProperty, intProperty, isBlockFormat, isCharFormat, isFrameFormat, isImageFormat, isListFormat, isTableFormat, layoutDirection, lengthProperty, lengthVectorProperty, merge, nativePointerArray, objectIndex, objectType, penProperty, properties, property, propertyCount, readFrom, setBackground, setForeground, setLayoutDirection, setObjectIndex, setObjectType, setProperty, setProperty, stringProperty, toBlockFormat, toCharFormat, toFrameFormat, toImageFormat, toListFormat, toTableFormat, type, writeTo
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QTextCharFormat

public QTextCharFormat()

Constructs a new character format object.

Method Detail

anchorHref

public final java.lang.String anchorHref()

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

See Also:
setAnchorHref

anchorNames

public final java.util.List<java.lang.String> anchorNames()

Returns the anchor names associated with this text format, or an empty string list if none has been set. If the anchor names are set, text with this format can be the destination of a hypertext link.

See Also:
setAnchorNames

font

public final QFont font()

Returns the font for this character format.

See Also:
setFont

fontFamily

public final java.lang.String fontFamily()

Returns the text format's font family.

See Also:
setFontFamily, font

fontFixedPitch

public final boolean fontFixedPitch()

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

See Also:
setFontFixedPitch, font

fontItalic

public final boolean fontItalic()

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

See Also:
setFontItalic, font

fontOverline

public final boolean fontOverline()

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

See Also:
setFontOverline, font

fontPointSize

public final double fontPointSize()

Returns the font size used to display text in this format.

See Also:
setFontPointSize, font

fontStrikeOut

public final boolean fontStrikeOut()

Returns true if the text format's font is struck out (has a horizontal line drawn through it); otherwise returns false.

See Also:
setFontStrikeOut, font

fontUnderline

public final boolean fontUnderline()

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

See Also:
setFontUnderline, font

fontWeight

public final int fontWeight()

Returns the text format's font weight.

See Also:
setFontWeight, font, QFont::Weight

isAnchor

public final boolean isAnchor()

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

See Also:
setAnchor, setAnchorHref, setAnchorNames

isValid

public boolean isValid()

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

Overrides:
isValid in class QTextFormat

setAnchor

public final void setAnchor(boolean anchor)

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 setAnchorNames to create a hypertext link.

See Also:
isAnchor

setAnchorHref

public final void setAnchorHref(java.lang.String value)

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

To format the text as a hypertext link use setAnchor.

See Also:
anchorHref

setAnchorNames

public final void setAnchorNames(java.util.List<java.lang.String> names)

Sets the text format's anchor names. For the anchor to work as a hyperlink, the destination must be set with setAnchorHref and the anchor must be enabled with setAnchor.

See Also:
anchorNames

setFont

public final void setFont(QFont font)

Sets the text format's font.

See Also:
font

setFontFamily

public final void setFontFamily(java.lang.String family)

Sets the text format's font family.

See Also:
fontFamily, setFont

setFontFixedPitch

public final void setFontFixedPitch(boolean fixedPitch)

If fixedPitch is true, sets the text format's font to be fixed pitch; otherwise a non-fixed pitch font is used.

See Also:
fontFixedPitch, setFont

setFontItalic

public final void setFontItalic(boolean italic)

If italic is true, sets the text format's font to be italic; otherwise the font will be non-italic.

See Also:
fontItalic, setFont

setFontOverline

public final void setFontOverline(boolean overline)

If overline is true, sets the text format's font to be overlined; otherwise the font is displayed non-overlined.

See Also:
fontOverline, setFont

setFontPointSize

public final void setFontPointSize(double size)

Sets the text format's font size.

See Also:
fontPointSize, setFont

setFontStrikeOut

public final void setFontStrikeOut(boolean strikeOut)

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:
fontStrikeOut, setFont

setFontUnderline

public final void setFontUnderline(boolean underline)

If underline is true, sets the text format's font to be underlined; otherwise it is displayed non-underlined.

See Also:
fontUnderline, setFont

setFontWeight

public final void setFontWeight(int weight)

Sets the text format's font weight to weight.

See Also:
fontWeight, setFont, QFont::Weight

setTableCellColumnSpan

public final void setTableCellColumnSpan(int tableCellColumnSpan)

See Also:
tableCellColumnSpan

setTableCellRowSpan

public final void setTableCellRowSpan(int tableCellRowSpan)

See Also:
tableCellRowSpan

setTextOutline

public final void setTextOutline(QPen pen)

Sets the pen used to draw the outlines of characters to the given pen.

See Also:
textOutline

setToolTip

public final void setToolTip(java.lang.String tip)

Sets the tool tip for a fragment of text to the given tip.

See Also:
toolTip

setUnderlineColor

public final void setUnderlineColor(QColor color)

Sets the underline color used for the characters with this format to the color specified.

See Also:
underlineColor

setUnderlineStyle

public final void setUnderlineStyle(QTextCharFormat.UnderlineStyle style)

Sets the style of underlining the text to style.

See Also:
underlineStyle

setVerticalAlignment

public final void setVerticalAlignment(QTextCharFormat.VerticalAlignment alignment)

Sets the vertical alignment used for the characters with this format to the alignment specified.

See Also:
verticalAlignment

tableCellColumnSpan

public final int tableCellColumnSpan()

See Also:
setTableCellColumnSpan

tableCellRowSpan

public final int tableCellRowSpan()

See Also:
setTableCellRowSpan

textOutline

public final QPen textOutline()

Returns the pen used to draw the outlines of characters in this format.

See Also:
setTextOutline

toolTip

public final java.lang.String toolTip()

Returns the tool tip that is displayed for a fragment of text.

See Also:
setToolTip

underlineColor

public final QColor underlineColor()

Returns the color used to underline the characters with this format.

See Also:
setUnderlineColor

underlineStyle

public final QTextCharFormat.UnderlineStyle underlineStyle()

Returns the style of underlining the text.

See Also:
setUnderlineStyle

verticalAlignment

public final QTextCharFormat.VerticalAlignment verticalAlignment()

Returns the vertical alignment used for characters with this format.

See Also:
setVerticalAlignment

fromNativePointer

public static QTextCharFormat fromNativePointer(QNativePointer nativePointer)
This function returns the QTextCharFormat instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.

nativePointerArray

public static QNativePointer nativePointerArray(QTextCharFormat[] array)
This function returns a QNativePointer that is pointing to the specified QTextCharFormat array.

Parameters:
array - the array that the returned pointer will point to.
Returns:
a QNativePointer that is pointing to the specified array.

Qt Jambi Home