Qt Code:
  1. fmetrics::fmetrics(QWidget *parent, Qt::WFlags flags)
  2. : QDialog(parent, flags)
  3. {
  4. ui.setupUi(this);
  5.  
  6. QFontMetrics metrics(ui.label->font());
  7. QFontMetrics metrics2(ui.label_2->font());
  8.  
  9. qDebug( QString("%1").arg(metrics.width(ui.label->text())).toAscii().constData() );
  10. qDebug( QString("%1").arg(metrics2.width(ui.label_2->text())).toAscii().constData() );
  11. }
To copy to clipboard, switch view to plain text mode 

label and label_2 are two QLabels with the same font set. One has normal font and the other has a bold font.

I always get a smaller width for the label with normal font. I tried with several fonts.

What font did you use?

Regards