Editor Height in QItemDelegate

I have a QListView with a custom implementation of QItemDelegate. MyItemDelegate re-creates createEditor () to display the custom widget. The size of the widget depends on the content. By default, the height of each line is about 20 pixels (one line), but my editor has a large height. I tried to override the QItemDelegate :: sizeHint () method, but does not contain an editor link, so I could not calculate the correct size.

How can I resize rows in a QListView to the actual editor size?

+4
source share
1 answer

You should emit layoutChanged after creating the editor if you cannot properly cancel sizeHint. But that should be enough to override sizeHint.

0
source

Source: https://habr.com/ru/post/1525416/


All Articles