PDA

View Full Version : QTableWidgetItem item size not correct using QFontMetrics, hack needed



Alundra
8th April 2016, 04:34
Hi,
I use this code to get the item width to resize the column to take the whole space :

const int messageWidth = QFontMetrics(messageItem->font()).width(text) + 6;
As you can see, one hack is needed, 6px needed to be added ot have the correct result.
Is it possible to have a way to avoid this magic number ?
Thanks for the help