CopperSpice API  1.9.1
QTextListFormat Class Reference

The QTextListFormat class provides formatting information for lists in a QTextDocument. More...

Inheritance diagram for QTextListFormat:
QTextFormat

Public Types

enum  Style
 
- Public Types inherited from QTextFormat
enum  FormatType
 
enum  ObjectTypes
 
enum  Property
 

Public Methods

 QTextListFormat ()
 
int indent () const
 
bool isValid () const
 
QString numberPrefix () const
 
QString numberSuffix () const
 
void setIndent (int indent)
 
void setNumberPrefix (const QString &prefix)
 
void setNumberSuffix (const QString &suffix)
 
void setStyle (Style style)
 
Style style () const
 
- Public Methods inherited from QTextFormat
 QTextFormat ()
 
 QTextFormat (const QTextFormat &other)
 
 QTextFormat (int type)
 
 ~QTextFormat ()
 
QBrush background () const
 
bool boolProperty (int propertyId) const
 
QBrush brushProperty (int propertyId) const
 
void clearBackground ()
 
void clearForeground ()
 
void clearProperty (int propertyId)
 
QColor colorProperty (int propertyId) const
 
qreal doubleProperty (int propertyId) const
 
QBrush foreground () const
 
bool hasProperty (int propertyId) const
 
int intProperty (int propertyId) const
 
bool isBlockFormat () const
 
bool isCharFormat () const
 
bool isEmpty () const
 
bool isFrameFormat () const
 
bool isImageFormat () const
 
bool isListFormat () const
 
bool isTableCellFormat () const
 
bool isTableFormat () const
 
bool isValid () const
 
Qt::LayoutDirection layoutDirection () const
 
QTextLength lengthProperty (int propertyId) const
 
QVector< QTextLengthlengthVectorProperty (int propertyId) const
 
void merge (const QTextFormat &other)
 
int objectIndex () const
 
int objectType () const
 
 operator QVariant () const
 
bool operator!= (const QTextFormat &other) const
 
QTextFormat & operator= (const QTextFormat &other)
 
bool operator== (const QTextFormat &other) const
 
QPen penProperty (int propertyId) const
 
QMap< int, QVariantproperties () const
 
QVariant property (int propertyId) const
 
int propertyCount () const
 
void setBackground (const QBrush &brush)
 
void setForeground (const QBrush &brush)
 
void setLayoutDirection (Qt::LayoutDirection direction)
 
void setObjectIndex (int index)
 
void setObjectType (int type)
 
void setProperty (int propertyId, const QVariant &value)
 
void setProperty (int propertyId, const QVector< QTextLength > &value)
 
QString stringProperty (int propertyId) const
 
void swap (QTextFormat &other)
 
QTextBlockFormat toBlockFormat () const
 
QTextCharFormat toCharFormat () const
 
QTextFrameFormat toFrameFormat () const
 
QTextImageFormat toImageFormat () const
 
QTextListFormat toListFormat () const
 
QTextTableCellFormat toTableCellFormat () const
 
QTextTableFormat toTableFormat () const
 
int type () const
 

Friends

class QTextFormat
 

Detailed Description

The QTextListFormat class provides formatting information for lists in a QTextDocument. A list is composed of one or more items, represented as text blocks. The list's format specifies the appearance of items in the list. In particular, it determines the indentation and the style of each item.

The indentation of the items is an integer value that causes each item to be offset from the left margin by a certain amount. This value is read with indent() and set with setIndent().

The style used to decorate each item is set with setStyle() and can be read with the style() function. The style controls the type of bullet points and numbering scheme used for items in the list. Note that lists that use the decimal numbering scheme begin counting at 1 rather than 0.

Style properties can be set to further configure the appearance of list items; for example, the ListNumberPrefix and ListNumberSuffix properties can be used to customize the numbers used in an ordered list so that they appear as (1), (2), (3), etc.

QTextListFormat listFormat;
listFormat.setStyle(QTextListFormat::ListDecimal);
listFormat.setNumberPrefix("(");
listFormat.setNumberSuffix(")");
cursor.insertList(listFormat);
See also
QTextList

Member Enumeration Documentation

This enum describes the symbols used to decorate list items:

ConstantValueDescription
QTextListFormat::ListDisc-1a filled circle
QTextListFormat::ListCircle-2an empty circle
QTextListFormat::ListSquare-3a filled square
QTextListFormat::ListDecimal-4decimal values in ascending order
QTextListFormat::ListLowerAlpha-5lower case Latin characters in alphabetical order
QTextListFormat::ListUpperAlpha-6upper case Latin characters in alphabetical order
QTextListFormat::ListLowerRoman-7lower case roman numerals (supports up to 4999 items only)
QTextListFormat::ListUpperRoman-8upper case roman numerals (supports up to 4999 items only)

Constructor & Destructor Documentation

QTextListFormat::QTextListFormat ( )

Constructs a new list format object.

Method Documentation

int QTextListFormat::indent ( ) const
inline

Returns the list format's indentation. The indentation is multiplied by the QTextDocument::indentWidth property to get the effective indent in pixels.

See also
setIndent()
bool QTextListFormat::isValid ( ) const
inline

Returns true if this list format is valid, otherwise returns false.

QString QTextListFormat::numberPrefix ( ) const
inline

Returns the list format's number prefix.

See also
setNumberPrefix()
QString QTextListFormat::numberSuffix ( ) const
inline

Returns the list format's number suffix.

See also
setNumberSuffix()
void QTextListFormat::setIndent ( int  indent)
inline

Sets this list format to the given indent. The indentation is multiplied by the QTextDocument::indentWidth property to get the effective indent in pixels.

See also
indent()
void QTextListFormat::setNumberPrefix ( const QString prefix)
inline

Sets the list format's number prefix to the string specified by prefix. This can be used with all sorted list types. It does not have any effect on unsorted list types. The default prefix is an empty string.

See also
numberPrefix()
void QTextListFormat::setNumberSuffix ( const QString suffix)
inline

Sets the list format's number suffix to the string specified by suffix. This can be used with all sorted list types. It does not have any effect on unsorted list types. The default suffix is ".".

See also
numberSuffix()
void QTextListFormat::setStyle ( Style  style)
inline

Sets the list format's style.

See also
style(), Style
Style QTextListFormat::style ( ) const
inline

Returns the list format's style.

See also
setStyle(), Style