I am using PySide6 and have a QTableWidget with many rows, and resizeColumnsToContents is very slow. I only need to resize the columns based on the width of a particular row. Presumably resizeColumnsToContents is searching for the widest row in the column, then updating with that, and so could be sped up by directly telling with which row to resize on.
I cannot find such a function in the API, so want to implement this using columnResized (first, finding the required width from the text of the widest row, then setting the column to this width). However, I cannot figure out how to calculate the required column size based on the text that I have. Any help would be much appreciated!