Hello,

How to properly calculate the column width in a view (e.g. QTableView), knowing the longest possible text string?
I've tried to use the QFontMetrics

QFontMetrics fm( myFont );

int colWidth = fm.width(QLatin1String("MyLongestColumnString");

Unfortunately, the column is still too narrow. I suppose a cell has margins, padding etc. How to obtain these values?

Thanks for your help