PySide2.QtWidgets.QListWidgetItem(icon, text[, listview=None[, type=Type]])
PySide2.QtWidgets.QListWidgetItem(other)
PySide2.QtWidgets.QListWidgetItem(text[, listview=None[, type=Type]])
param listview:
PySide2.QtWidgets.QListWidget
param type:
param icon:
PySide2.QtGui.QIcon
param other:
PySide2.QtWidgets.QListWidgetItem
param text:
Constructs an empty list widget item of the specified type
with the given parent
. If parent
is not specified, the item will need to be inserted into a list widget with insertItem()
.
This constructor inserts the item into the model of the parent that is passed to the constructor. If the model is sorted then the behavior of the insert is undetermined since the model will call the '<'
operator method on the item which, at this point, is not yet constructed. To avoid the undetermined behavior, we recommend not to specify the parent and use insertItem()
instead.
See also
type()
Constructs an empty list widget item of the specified type
with the given icon
, text
and parent
. If the parent is not specified, the item will need to be inserted into a list widget with insertItem()
.
This constructor inserts the item into the model of the parent that is passed to the constructor. If the model is sorted then the behavior of the insert is undetermined since the model will call the '<'
operator method on the item which, at this point, is not yet constructed. To avoid the undetermined behavior, we recommend not to specify the parent and use insertItem()
instead.
See also
type()
Constructs a copy of other
. Note that type()
and listWidget()
are not copied.
This function is useful when reimplementing clone()
.
See also
data()
flags()
Constructs an empty list widget item of the specified type
with the given text
and parent
. If the parent is not specified, the item will need to be inserted into a list widget with insertItem()
.
This constructor inserts the item into the model of the parent that is passed to the constructor. If the model is sorted then the behavior of the insert is undetermined since the model will call the '<'
operator method on the item which, at this point, is not yet constructed. To avoid the undetermined behavior, we recommend not to specify the parent and use insertItem()
instead.
See also
type()
PySide2.QtWidgets.QListWidgetItem.ItemType
This enum describes the types that are used to describe list widget items.
Constant
Description
QListWidgetItem.Type
The default type for list widget items.
QListWidgetItem.UserType
The minimum value for custom types. Values below are reserved by Qt.
You can define new user types in QListWidgetItem
subclasses to ensure that custom items are treated specially.
See also
type()
Returns the item’s data for a given role
. Reimplement this function if you need extra roles or special behavior for certain roles.
See also
ItemDataRole
setData()
Sets the background brush of the list item to the given brush
. Setting a default-constructed brush will let the view use the default color from the style.
See also
background()
setForeground()
Sets the data for a given role
to the given value
. Reimplement this function if you need extra roles or special behavior for certain roles.
The default implementation treats EditRole
and DisplayRole
as referring to the same data.
See also
ItemDataRole
data()
Sets the foreground brush of the list item to the given brush
. Setting a default-constructed brush will let the view use the default color from the style.
See also
foreground()
setBackground()
Sets the size hint for the list item to be size
. If no size hint is set or size
is invalid, the item delegate will compute the size hint based on the item data.
See also
sizeHint()
Sets the status tip for the list item to the text specified by statusTip
. QListWidget
mouseTracking needs to be enabled for this feature to work.
See also
statusTip()
setToolTip()
setWhatsThis()
setMouseTracking()
Sets the “What’s This?” help for the list item to the text specified by whatsThis
.
See also
whatsThis()
setStatusTip()
setToolTip()
Returns the color used to display the list item’s text.
This function is deprecated. Use foreground()
instead.
See also
setTextColor()
© 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.