|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.gui.QTextFormat
public class QTextFormat
The QTextFormat class provides formatting information for a QTextDocument.
A QTextFormat is a generic class used for describing the format of parts of a QTextDocument. The derived classes QTextCharFormat, QTextBlockFormat, QTextListFormat, and QTextTableFormat are usually more useful, and describe the formatting that is applied to specific parts of the document.
A format has a FormatType which specifies the kinds of thing it can format; e.g. a block of text, a list, a table, etc. A format also has various properties (some specific to particular format types), as described by the Property enum. Every property has a corresponding Property.
The format type is given by type, and the format can be tested with isCharFormat, isBlockFormat, isListFormat, isTableFormat, isFrameFormat, and isImageFormat. If the type is determined, it can be retrieved with toCharFormat, toBlockFormat, toListFormat, toTableFormat, toFrameFormat, and toImageFormat.
A format's properties can be set with the setProperty functions, and retrieved with boolProperty, intProperty, doubleProperty, and stringProperty as appropriate. All the property IDs used in the format can be retrieved with allPropertyIds(). One format can be merged into another using merge.
A format's object index can be set with setObjectIndex, and retrieved with objectIndex. These methods can be used to associate the format with a QTextObject. It is used to represent lists, frames, and tables inside the document.
Processing Classes
Nested Class Summary | |
---|---|
static class |
QTextFormat.FormatType
Press link for info on QTextFormat.FormatType |
static class |
QTextFormat.ObjectTypes
Press link for info on QTextFormat.ObjectTypes |
static class |
QTextFormat.PageBreakFlag
Press link for info on QTextFormat.PageBreakFlag |
static class |
QTextFormat.PageBreakFlags
This QFlag class provides flags for the int enum. |
static class |
QTextFormat.Property
Press link for information on 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 | |
---|---|
QTextFormat()
Creates a new text format with an InvalidFormat. |
|
QTextFormat(int type)
Creates a new text format of the given type. |
|
QTextFormat(QTextFormat rhs)
Creates a new text format with the same attributes as the rhs text format. |
Method Summary | |
---|---|
QBrush |
background()
Returns the brush used to paint the document's background. |
boolean |
boolProperty(int propertyId)
Returns the value of the property specified by propertyId. |
QBrush |
brushProperty(int propertyId)
Returns the value of the property given by propertyId; if the property isn't of QVariant::Brush type, Qt::NoBrush is returned instead. |
void |
clearBackground()
Clears the brush used to paint the document's background. |
void |
clearForeground()
Clears the brush used to paint the document's foreground. |
void |
clearProperty(int propertyId)
Clears the value of the property given by propertyId |
QColor |
colorProperty(int propertyId)
Returns the value of the property given by propertyId; if the property isn't of QVariant::Color type, an invalid color is returned instead. |
double |
doubleProperty(int propertyId)
Returns the value of the property specified by propertyId. |
boolean |
equals(java.lang.Object other)
|
QBrush |
foreground()
Returns the brush used to render foreground details, such as text, frame outlines, and table borders. |
static QTextFormat |
fromNativePointer(QNativePointer nativePointer)
This function returns the QTextFormat instance pointed to by nativePointer |
boolean |
hasProperty(int propertyId)
Returns true if the text format has a property with the given propertyId; otherwise returns false. |
int |
intProperty(int propertyId)
Returns the value of the property specified by propertyId. |
boolean |
isBlockFormat()
Returns true if this text format is a BlockFormat; otherwise returns false. |
boolean |
isCharFormat()
Returns true if this text format is a CharFormat; otherwise returns false. |
boolean |
isFrameFormat()
Returns true if this text format is a FrameFormat; otherwise returns false. |
boolean |
isImageFormat()
Returns true if this text format is an image format; otherwise returns false. |
boolean |
isListFormat()
Returns true if this text format is a ListFormat; otherwise returns false. |
boolean |
isTableFormat()
Returns true if this text format is a TableFormat; otherwise returns false. |
boolean |
isValid()
Returns true if the format is valid (i.e. is not InvalidFormat); otherwise returns false. |
Qt.LayoutDirection |
layoutDirection()
Returns the document's layout direction. |
QTextLength |
lengthProperty(int propertyId)
Returns the value of the property given by propertyId. |
java.util.List<QTextLength> |
lengthVectorProperty(int propertyId)
Returns the value of the property given by propertyId. |
void |
merge(QTextFormat other)
Merges the other format with this format; where there are conflicts the other format takes precedence. |
static QNativePointer |
nativePointerArray(QTextFormat[] array)
This function returns a QNativePointer that is pointing to the specified QTextFormat array. |
int |
objectIndex()
Returns the index of the format object, or -1 if the format object is invalid. |
int |
objectType()
Returns the text format's object type. |
QPen |
penProperty(int propertyId)
Returns the value of the property given by propertyId; if the property isn't of QVariant::Pen type, Qt::NoPen is returned instead. |
java.util.SortedMap<java.lang.Integer,java.lang.Object> |
properties()
Returns a map with all properties of this text format. |
java.lang.Object |
property(int propertyId)
Returns the property specified by the given propertyId. |
int |
propertyCount()
Returns the number of properties stored in the format. |
void |
readFrom(QDataStream arg__1)
Reads a QTextFormat from arg__1. |
void |
setBackground(QBrush brush)
Sets the brush use to paint the document's background to the brush specified. |
void |
setForeground(QBrush brush)
Sets the foreground brush to the specified brush. |
void |
setLayoutDirection(Qt.LayoutDirection direction)
Sets the document's layout direction to the specified direction. |
void |
setObjectIndex(int object)
Sets the format object's object object. |
void |
setObjectType(int type)
Sets the text format's object type. |
void |
setProperty(int propertyId,
java.util.List<QTextLength> lengths)
Sets the value of the property given by propertyId to lengths. |
void |
setProperty(int propertyId,
java.lang.Object value)
Sets the property specified by the propertyId to the given value. |
java.lang.String |
stringProperty(int propertyId)
Returns the value of the property given by propertyId; if the property isn't of QVariant::String type, an empty string is returned instead. |
QTextBlockFormat |
toBlockFormat()
Returns this format as a block format. |
QTextCharFormat |
toCharFormat()
Returns this format as a character format. |
QTextFrameFormat |
toFrameFormat()
Returns this format as a frame format. |
QTextImageFormat |
toImageFormat()
Returns this format as an image format. |
QTextListFormat |
toListFormat()
Returns this format as a list format. |
QTextTableFormat |
toTableFormat()
Returns this format as a table format. |
int |
type()
Returns the type of this format. |
void |
writeTo(QDataStream arg__1)
Writes thisQTextFormat to arg__1. |
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 |
---|
public QTextFormat(QTextFormat rhs)
Creates a new text format with the same attributes as the rhs text format.
public QTextFormat()
Creates a new text format with an InvalidFormat.
public QTextFormat(int type)
Creates a new text format of the given type.
Method Detail |
---|
public final QBrush background()
Returns the brush used to paint the document's background.
public final boolean boolProperty(int propertyId)
Returns the value of the property specified by propertyId. If the property isn't of QTextFormat::Bool type, false is returned instead.
public final QBrush brushProperty(int propertyId)
Returns the value of the property given by propertyId; if the property isn't of QVariant::Brush type, Qt::NoBrush is returned instead.
public final void clearBackground()
Clears the brush used to paint the document's background. The default brush will be used.
public final void clearForeground()
Clears the brush used to paint the document's foreground. The default brush will be used.
public final void clearProperty(int propertyId)
Clears the value of the property given by propertyId
public final QColor colorProperty(int propertyId)
Returns the value of the property given by propertyId; if the property isn't of QVariant::Color type, an invalid color is returned instead.
public final double doubleProperty(int propertyId)
Returns the value of the property specified by propertyId. If the property isn't of QVariant::Double type, 0 is returned instead.
public final QBrush foreground()
Returns the brush used to render foreground details, such as text, frame outlines, and table borders.
public final boolean hasProperty(int propertyId)
Returns true if the text format has a property with the given propertyId; otherwise returns false.
public final int intProperty(int propertyId)
Returns the value of the property specified by propertyId. If the property is not of QTextFormat::Integer type, 0 is returned instead.
public final boolean isBlockFormat()
Returns true if this text format is a BlockFormat; otherwise returns false.
public final boolean isCharFormat()
Returns true if this text format is a CharFormat; otherwise returns false.
public final boolean isFrameFormat()
Returns true if this text format is a FrameFormat; otherwise returns false.
public final boolean isImageFormat()
Returns true if this text format is an image format; otherwise returns false.
public final boolean isListFormat()
Returns true if this text format is a ListFormat; otherwise returns false.
public final boolean isTableFormat()
Returns true if this text format is a TableFormat; otherwise returns false.
public boolean isValid()
Returns true if the format is valid (i.e. is not InvalidFormat); otherwise returns false.
public final Qt.LayoutDirection layoutDirection()
Returns the document's layout direction.
public final QTextLength lengthProperty(int propertyId)
Returns the value of the property given by propertyId.
public final java.util.List<QTextLength> lengthVectorProperty(int propertyId)
Returns the value of the property given by propertyId. If the property isn't of QTextFormat::LengthVector type, an empty length vector is returned instead.
public final void merge(QTextFormat other)
Merges the other format with this format; where there are conflicts the other format takes precedence.
public final int objectIndex()
Returns the index of the format object, or -1 if the format object is invalid.
public final int objectType()
Returns the text format's object type. See ObjectTypes.
public final void writeTo(QDataStream arg__1)
public final void readFrom(QDataStream arg__1)
public final QPen penProperty(int propertyId)
Returns the value of the property given by propertyId; if the property isn't of QVariant::Pen type, Qt::NoPen is returned instead.
public final java.util.SortedMap<java.lang.Integer,java.lang.Object> properties()
Returns a map with all properties of this text format.
public final java.lang.Object property(int propertyId)
Returns the property specified by the given propertyId.
public final int propertyCount()
Returns the number of properties stored in the format.
public final void setBackground(QBrush brush)
Sets the brush use to paint the document's background to the brush specified.
public final void setForeground(QBrush brush)
Sets the foreground brush to the specified brush. The foreground brush is mostly used to render text.
public final void setLayoutDirection(Qt.LayoutDirection direction)
Sets the document's layout direction to the specified direction.
public final void setObjectIndex(int object)
Sets the format object's object object.
public final void setObjectType(int type)
Sets the text format's object type. See ObjectTypes.
public final void setProperty(int propertyId, java.util.List<QTextLength> lengths)
Sets the value of the property given by propertyId to lengths.
public final void setProperty(int propertyId, java.lang.Object value)
Sets the property specified by the propertyId to the given value.
public final java.lang.String stringProperty(int propertyId)
Returns the value of the property given by propertyId; if the property isn't of QVariant::String type, an empty string is returned instead.
public final QTextBlockFormat toBlockFormat()
Returns this format as a block format.
public final QTextCharFormat toCharFormat()
Returns this format as a character format.
public final QTextFrameFormat toFrameFormat()
Returns this format as a frame format.
public final QTextImageFormat toImageFormat()
Returns this format as an image format.
public final QTextListFormat toListFormat()
Returns this format as a list format.
public final QTextTableFormat toTableFormat()
Returns this format as a table format.
public final int type()
Returns the type of this format.
public static QTextFormat fromNativePointer(QNativePointer nativePointer)
nativePointer
- the QNativePointer of which object should be returned.public static QNativePointer nativePointerArray(QTextFormat[] array)
array
- the array that the returned pointer will point to.
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |