QTextListFormat¶
The
QTextListFormat
class provides formatting information for lists in aQTextDocument
. More…
Synopsis¶
Functions¶
def
indent
()def
numberPrefix
()def
numberSuffix
()def
setIndent
(indent)def
setNumberPrefix
(numberPrefix)def
setNumberSuffix
(numberSuffix)def
setStyle
(style)def
style
()
Detailed Description¶
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
ListNumberPrefix
andListNumberSuffix
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
- class PySide2.QtGui.QTextListFormat¶
PySide2.QtGui.QTextListFormat(fmt)
PySide2.QtGui.QTextListFormat(QTextListFormat)
- param fmt:
- param QTextListFormat:
Constructs a new list format object.
- PySide2.QtGui.QTextListFormat.Style¶
This enum describes the symbols used to decorate list items:
Constant
Description
QTextListFormat.ListDisc
a filled circle
QTextListFormat.ListCircle
an empty circle
QTextListFormat.ListSquare
a filled square
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()¶
- Return type:
int
Returns the list format’s indentation. The indentation is multiplied by the
indentWidth
property to get the effective indent in pixels.See also
- PySide2.QtGui.QTextListFormat.numberPrefix()¶
- Return type:
str
Returns the list format’s number prefix.
See also
- PySide2.QtGui.QTextListFormat.numberSuffix()¶
- Return type:
str
Returns the list format’s number suffix.
See also
- PySide2.QtGui.QTextListFormat.setIndent(indent)¶
- Parameters:
indent – int
Sets the list format’s
indentation
. The indentation is multiplied by theindentWidth
property to get the effective indent in pixels.See also
- PySide2.QtGui.QTextListFormat.setNumberPrefix(numberPrefix)¶
- Parameters:
numberPrefix – str
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.
See also
- PySide2.QtGui.QTextListFormat.setNumberSuffix(numberSuffix)¶
- Parameters:
numberSuffix – str
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 “.”.
See also
- PySide2.QtGui.QTextListFormat.setStyle(style)¶
- Parameters:
style –
Style
Sets the list format’s
style
.See also
style()
Style
- PySide2.QtGui.QTextListFormat.style()¶
- Return type:
Returns the list format’s style.
See also
setStyle()
Style
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.