PyQt5 QListWidget – Setting Selection Rectangle Visible Property
In this article we will see how we can set the selection rectangle visible property 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. If this property is true then the selection rectangle is visible; otherwise it will be hidden.
Note: The selection rectangle will only be visible if the selection mode is in a mode where more than one item can be selected; i.e., it will not draw a selection rectangle if the selection mode is QAbstractItemView.SingleSelection.
In order to do this we will use
setSelectionRectVisiblemethod with the list widget object.
Syntax : list_widget.setSelectionRectVisible(True)
Argument : It takes bool as argument
Return : It returns None
Below is the implementation