Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, August 2006
QPainter drawText() - bug or feature?


Message 1 in thread

Hi!

I don't understand why this code don't work correctly:

QFont font;
QFontMetricsF fontMetrics(font);
QRectF boundingRect = fontMetrics.boundingRect(QString::number(0.0, 'E'));
painter->drawText(boundingRect, Qt::AlignCenter, 
QString::number(sensor()->value(), 'E'));

I suppose to see something like "0.000000E+00" text on screen, but 
really top of this text is stripped. You can see results in 1.png from 
attachments. Is it a bug or feature of drawText()?

P. S. I'm using Qt 4.1 TP 1.

PNG image

PNG image