PyQt5 QListWidget – Setting Item Alignment
In this article we will see how we can set the item alignment of the QListWidget. QListWidget is a convenience class that provides a list view with a classic item-based interface for adding and removing items. QListWidget uses an internal model to manage each QListWidgetItem in the list. This property holds the alignment of each item in its cell. This is only supported in ListMode with TopToBottom flow and with wrapping enabled. The default alignment is 0, which means that an item fills its cell entirely.
In order to do this we will use
setItemAlignmentmethod with the list widget object.
Syntax : list_widget.setItemAlignment(alignment)
Argument : It takes alignment object argument
Return : It returns None
Below is the implementation