QTextListFormatclass provides formatting information for lists in aQTextDocument. 更多 …
def
indent
()
def
numberPrefix
()
def
numberSuffix
()
def
setIndent
(indent)
def
setNumberPrefix
(numberPrefix)
def
setNumberSuffix
(numberSuffix)
def
setStyle
(style)
def
style
()
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 withsetIndent().The style used to decorate each item is set with
setStyle()and can be read with thestyle()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
ListNumberPrefixandListNumberSuffixproperties 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);另请参阅
QTextListFormat
¶
QTextListFormat(fmt)
QTextListFormat(QTextListFormat)
- param fmt
- param QTextListFormat
构造新列表格式对象。
PySide2.QtGui.QTextListFormat.
Style
¶
此枚举描述用于装饰列表项的符号:
|
常量 |
描述 |
|---|---|
|
QTextListFormat.ListDisc |
a filled circle |
|
QTextListFormat.ListCircle |
空心圆 |
|
QTextListFormat.ListSquare |
填充正方形 |
|
QTextListFormat.ListDecimal |
decimal values in ascending order |
|
QTextListFormat.ListLowerAlpha |
lower case Latin characters in alphabetical order |
|
QTextListFormat.ListUpperAlpha |
upper case Latin characters in alphabetical order |
|
QTextListFormat.ListLowerRoman |
lower case roman numerals (supports up to 4999 items only) |
|
QTextListFormat.ListUpperRoman |
upper case roman numerals (supports up to 4999 items only) |
PySide2.QtGui.QTextListFormat.
indent
(
)
¶
int
Returns the list format’s indentation. The indentation is multiplied by the
indentWidth
property to get the effective indent in pixels.
另请参阅
PySide2.QtGui.QTextListFormat.
numberPrefix
(
)
¶
unicode
Returns the list format’s number prefix.
另请参阅
PySide2.QtGui.QTextListFormat.
numberSuffix
(
)
¶
unicode
Returns the list format’s number suffix.
另请参阅
PySide2.QtGui.QTextListFormat.
setIndent
(
indent
)
¶
indent
–
int
Sets the list format’s
indentation
. The indentation is multiplied by the
indentWidth
property to get the effective indent in pixels.
另请参阅
PySide2.QtGui.QTextListFormat.
setNumberPrefix
(
numberPrefix
)
¶
numberPrefix – unicode
Sets the list format’s number prefix to the string specified by
numberPrefix
. 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.
另请参阅
PySide2.QtGui.QTextListFormat.
setNumberSuffix
(
numberSuffix
)
¶
numberSuffix – unicode
Sets the list format’s number suffix to the string specified by
numberSuffix
. This can be used with all sorted list types. It does not have any effect on unsorted list types.
The default suffix is “.”.
另请参阅
PySide2.QtGui.QTextListFormat.
setStyle
(
style
)
¶
style
–
Style
Sets the list format’s
style
.
另请参阅
style()
Style
PySide2.QtGui.QTextListFormat.
style
(
)
¶
Returns the list format’s style.
另请参阅
setStyle()
Style