Maxim Popravko
Maxim Popravko

Reputation: 4159

Wrong table cell size rendered in QTableWidget. How can I fix it?

I have an application, written in PyQt. I use QTableWidget-based class for grids. All is Ok, except that in some cases (long text data in cells) item size is determined wrong and some clipping occures. Quick'n'dirty hack is to override delegate's sizeHint() function, but there are thousands of items in the table, and I think, that calling python (!) function for every and each cell of the huge table is bad. Moreover, let's say, 5px borders for all (not only those, badly rendered) items isn't pretty.

Wrong item size

Can someone provide more abequate way to fix it?

Upvotes: 1

Views: 796

Answers (2)

Maxim Popravko
Maxim Popravko

Reputation: 4159

I supposed to use QStyledItemDelegate to inherit my custom delegate of. With QStyledItemDelegate items are rendered fine!

Upvotes: 1

D K
D K

Reputation: 5750

You should be able to call QTableWidget().verticalHeader().setDefaultSectionSize(rowheight) to set the base size for all table rows.

Upvotes: 0

Related Questions