user1767754
user1767754

Reputation: 25094

PyQT: Creating custom Widgets for QListView

I want to add a custom Widget to the QListView, i read already the SO thread about Delegates. QListView/QListWidget with custom items and custom item widgets

But how is this applied in pyqt? i couldn't find any example. Some articles show how to overwrite the paint function, which will only change the appearance but not add a widget as an item.

Upvotes: 0

Views: 2430

Answers (1)

Maxim Popravko
Maxim Popravko

Reputation: 4159

setCellWidget() if you can switch to QListWidget or QTableWidget add custom widget to QTableWidget cell

...or you can just spawn new Widget in a cell rectangle via delegate like I do here: delegate that edits bound python object properties

We used code like this to handle text, number, date, boolean, image, document file, coordinate, list properties etc of our domain objects.

Upvotes: 2

Related Questions