QTextListFormat Class
The QTextListFormat class provides formatting information for lists in a QTextDocument. More...
Header: | #include <QTextListFormat> |
qmake: | QT += gui |
Inherits: | QTextFormat |
Note: All functions in this class are reentrant.
Public Types
enum | Style { ListDisc, ListCircle, ListSquare, ListDecimal, ..., ListUpperRoman } |
Public Functions
QTextListFormat() | |
int | indent() const |
bool | isValid() const |
QString | numberPrefix() const |
QString | numberSuffix() const |
void | setIndent(int indent) |
void | setNumberPrefix(const QString &numberPrefix) |
void | setNumberSuffix(const QString &numberSuffix) |
void | setStyle(QTextListFormat::Style style) |
QTextListFormat::Style | style() const |
- 51 public functions inherited from QTextFormat
Protected Functions
QTextListFormat(const QTextFormat &fmt) |
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 Type Documentation
enum QTextListFormat::Style
This enum describes the symbols used to decorate list items:
Constant | Value | Description |
---|---|---|
QTextListFormat::ListDisc | -1 | a filled circle |
QTextListFormat::ListCircle | -2 | an empty circle |
QTextListFormat::ListSquare | -3 | a filled square |
QTextListFormat::ListDecimal | -4 | decimal values in ascending order |
QTextListFormat::ListLowerAlpha | -5 | lower case Latin characters in alphabetical order |
QTextListFormat::ListUpperAlpha | -6 | upper case Latin characters in alphabetical order |
QTextListFormat::ListLowerRoman | -7 | lower case roman numerals (supports up to 4999 items only) |
QTextListFormat::ListUpperRoman | -8 | upper case roman numerals (supports up to 4999 items only) |
Member Function Documentation
QTextListFormat::QTextListFormat()
Default constructs an instance of QTextListFormat.
[protected]
QTextListFormat::QTextListFormat(const QTextFormat &fmt)
Default constructs an instance of QTextListFormat.
int QTextListFormat::indent() const
See also setIndent().
bool QTextListFormat::isValid() const
QString QTextListFormat::numberPrefix() const
See also setNumberPrefix().
QString QTextListFormat::numberSuffix() const
See also setNumberSuffix().
void QTextListFormat::setIndent(int indent)
See also indent().
void QTextListFormat::setNumberPrefix(const QString &numberPrefix)
See also numberPrefix().
void QTextListFormat::setNumberSuffix(const QString &numberSuffix)
See also numberSuffix().
void QTextListFormat::setStyle(QTextListFormat::Style style)
See also style().
QTextListFormat::Style QTextListFormat::style() const
See also setStyle().