|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.internal.QSignalEmitterInternal
com.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.
Nested Class Summary | |
---|---|
static class |
QTextFormat.FormatType
|
static class |
QTextFormat.ObjectTypes
|
static class |
QTextFormat.PageBreakFlag
|
static class |
QTextFormat.PageBreakFlags
|
static class |
QTextFormat.Property
Paragraph and character properties Paragraph properties Character properties List properties Table and frame properties Table cell properties Image properties Selection properties Page break properties |
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter |
---|
QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9 |
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal |
Field Summary |
---|
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
currentSender |
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 other 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 |
QTextFormat |
clone()
This method is reimplemented for internal reasons |
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. |
QBrush |
foreground()
Returns the brush used to render foreground details, such as text, frame outlines, and table borders. |
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 |
isTableCellFormat()
Returns true if this text format is a TableCellFormat; 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. |
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 |
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. |
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 |
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)
|
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 index. |
void |
setObjectType(int type)
Sets the text format's object type. |
void |
setProperty(int propertyId,
java.util.List lengths)
Sets the value of the property given by propertyId to value. |
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. |
QTextTableCellFormat |
toTableCellFormat()
Returns this format as a table cell format. |
QTextTableFormat |
toTableFormat()
Returns this format as a table format. |
int |
type()
Returns the type of this format. |
void |
writeTo(QDataStream arg__1)
|
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread |
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
__qt_signalInitialization |
Methods inherited from class java.lang.Object |
---|
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()
FormatType
.
public QTextFormat(QTextFormat rhs)
public QTextFormat(int type)
FormatType
.
Method Detail |
---|
public final QBrush background()
setBackground()
, clearBackground()
, and foreground()
.
public final boolean boolProperty(int propertyId)
setProperty()
, intProperty()
, doubleProperty()
, stringProperty()
, colorProperty()
, lengthProperty()
, lengthVectorProperty()
, and Property
.
public final QBrush brushProperty(int propertyId)
QVariant::Brush
type, Qt::NoBrush
is returned instead. setProperty()
, boolProperty()
, intProperty()
, doubleProperty()
, stringProperty()
, lengthProperty()
, lengthVectorProperty()
, and Property
.
public final void clearBackground()
background()
, setBackground()
, and clearForeground()
.
public final void clearForeground()
foreground()
, setForeground()
, and clearBackground()
.
public final void clearProperty(int propertyId)
public final QColor colorProperty(int propertyId)
QVariant::Color
type, an invalid color is returned instead. setProperty()
, boolProperty()
, intProperty()
, doubleProperty()
, stringProperty()
, lengthProperty()
, lengthVectorProperty()
, and Property
.
public final double doubleProperty(int propertyId)
QVariant::Double
type, 0 is returned instead. setProperty()
, boolProperty()
, intProperty()
, stringProperty()
, colorProperty()
, lengthProperty()
, lengthVectorProperty()
, and Property
.
public final QBrush foreground()
setForeground()
, clearForeground()
, and background()
.
public final boolean hasProperty(int propertyId)
properties()
, and Property
.
public final int intProperty(int propertyId)
setProperty()
, boolProperty()
, doubleProperty()
, stringProperty()
, colorProperty()
, lengthProperty()
, lengthVectorProperty()
, and Property
.
public final boolean isBlockFormat()
public final boolean isCharFormat()
public final boolean isFrameFormat()
public final boolean isImageFormat()
public final boolean isListFormat()
public final boolean isTableCellFormat()
public final boolean isTableFormat()
public boolean isValid()
InvalidFormat
); otherwise returns false.
public final Qt.LayoutDirection layoutDirection()
setLayoutDirection()
.
public final QTextLength lengthProperty(int propertyId)
setProperty()
, boolProperty()
, intProperty()
, doubleProperty()
, stringProperty()
, colorProperty()
, lengthVectorProperty()
, and Property
.
public final java.util.List lengthVectorProperty(int propertyId)
setProperty()
, boolProperty()
, intProperty()
, doubleProperty()
, stringProperty()
, colorProperty()
, lengthProperty()
, and Property
.
public final void merge(QTextFormat other)
public final int objectIndex()
setObjectIndex()
.
public final int objectType()
setObjectType()
.
public final void writeTo(QDataStream arg__1)
public final void readFrom(QDataStream arg__1)
public final QPen penProperty(int propertyId)
QVariant::Pen
type, Qt::NoPen
is returned instead. setProperty()
, boolProperty()
, intProperty()
, doubleProperty()
, stringProperty()
, lengthProperty()
, lengthVectorProperty()
, and Property
.
public final java.util.SortedMap properties()
public final java.lang.Object property(int propertyId)
setProperty()
.
public final int propertyCount()
public final void setBackground(QBrush brush)
background()
, clearBackground()
, and setForeground()
.
public final void setForeground(QBrush brush)
foreground()
, clearForeground()
, and setBackground()
.
public final void setLayoutDirection(Qt.LayoutDirection direction)
layoutDirection()
.
public final void setObjectIndex(int object)
objectIndex()
.
public final void setObjectType(int type)
objectType()
.
public final void setProperty(int propertyId, java.lang.Object value)
property()
.
public final void setProperty(int propertyId, java.util.List lengths)
lengthVectorProperty()
, and Property
.
public final java.lang.String stringProperty(int propertyId)
QVariant::String
type, an empty string is returned instead. setProperty()
, boolProperty()
, intProperty()
, doubleProperty()
, colorProperty()
, lengthProperty()
, lengthVectorProperty()
, and Property
.
public final QTextBlockFormat toBlockFormat()
public final QTextCharFormat toCharFormat()
public final QTextFrameFormat toFrameFormat()
public final QTextImageFormat toImageFormat()
public final QTextListFormat toListFormat()
public final QTextTableCellFormat toTableCellFormat()
public final QTextTableFormat toTableFormat()
public final int type()
FormatType
.
public QTextFormat clone()
clone
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |