QListWidget setItemWidget spacing on right
-
Hello,
I have QListWidget. I am using setItemWidget to show my custom widget on QListWidget.This is my list:
Code for add widget to list:
wid = MyCustomWidget(data=data) item = QListWidgetItem() item.setData(Qt.UserRole+1, data) # for access data item.setSizeHint(wid.sizeHint()) Liste.addItem(item) # my QListWidget Liste.setItemWidget(item, wid)
But as you can see in image, there is gap/spacing on right side. I want this gap/spacing to be on the left. So the gap/spacing on left and right side should be equal.
Note: I will have like 200 item/widget. I would appreciate if you could suggest other objects for performance.
Thanks. -
Hi and welcome to devnet,
For performance, QStyledItemDelegate is what you should use.
setItemWidget is to show some static content but not to show static content on every cells.
-
@SGaist Thank you.
This is my animated custom widget: Imgur my custom widget
I have never used QStyledItemDelegate. Is it possible to do the same as in this gif (animations too) with QStyledItemDelegate? -
AFAIK, it should be doable.